Skip to content

Architecture: Bootstrap Notes

This short guide explains how the plugin boots, where core responsibilities live, and where integrators should add new behavior.

  1. dino-discounts.php wires activation/deactivation hooks, compatibility flags, and the main plugin bootstrap.
  2. includes/Plugin.php registers core services (REST, storefront hooks, migrations, assets, admin wiring).
  3. REST controllers are registered under dino-discounts/v1 and gate access through AbstractController::check_permission().
  4. Rule evaluation happens through RulesEngine, which delegates the per-section checks to RuleMatcher and the section evaluators in includes/Engine/Evaluators/ (WhoEvaluator, WhenEvaluator, WhereEvaluator, TriggerEvaluator).
  • includes/Engine/: rule matching, targeting, reward strategy selection, and runtime guards.
  • includes/Cart/: coupon and coupon-code lifecycle, linking, export, and redemption state.
  • includes/API/: admin and debug endpoints used by the React UI.
  • includes/Storefront/: cart/checkout rendering and runtime storefront behavior.
  • src/components/: admin application UI, rule builder, coupons, preview, and shared controls.
  • Prefer extending existing services/controllers over introducing new static utilities.
  • Add tests for behavior-heavy changes in tests/Unit before moving UI or endpoint wiring.
  • When changing UI request flows, use apiFetch and expose explicit user-facing error states.
  • For complex rule/coupon edits, keep pure transformation helpers small and isolated so they are testable.

WooCommerce is a trademark of Automattic, Inc. WordPress is a trademark of the WordPress Foundation. Dino Discounts is not affiliated with or endorsed by Automattic or the WordPress Foundation.

Contact · Report a bug