Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/javiquint1/company-order-metadata/archive/refs/heads/feature%2Fadmin-ui.zipNo built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.
Architecture
This plugin is built using a single responsibility approach:
- A bootstrap file for registration
- A namespaced main Plugin class
- WooCommerce hooks for behavior extension
No core or theme files are modified.
Hooks Used and Why
woocommerce_checkout_create_order: Fires once when the order object is created, ensuring the reference is generated only once.woocommerce_admin_order_data_after_order_details: Cleanly displays read-only metadata in the admin UI.company_order_reference_code(custom filter): Allows other plugins or custom code to modify the reference format.
Testing Strategy (Production-Safe)
- Place test orders in staging
- Verify reference code is created once
- Confirm no duplication on order updates
- Check admin UI visibility
- Load test bulk orders via WooCommerce tools
Performance Considerations
- Executes only during order creation
- Single meta read/write per order
- No queries on frontend rendering
- Scales linearly even on high-volume stores
Future Improvement
With more time, I would:
- Add REST API exposure for the reference code
- Add automated PHPUnit/WP tests
- Add optional prefix/year customization via settings