Architecture Overview
Runtime Shape
Section titled “Runtime Shape”UpsellBay is a WooCommerce-native offer engine. Its runtime code lives under app/ and uses the namespace WPAnchorBay\UpsellBay.
The plugin follows a small-service architecture:
upsellbay.phpLoads the plugin, runs environment checks, and starts the bootstrap.app/Core/Plugin.phpCoordinates service registration, WordPress hooks, and module startup order.app/Core/Container.phpProvides a lightweight dependency container for runtime services.
Main Modules
Section titled “Main Modules”CoreShared identifiers, bootstrap, settings, installer, scheduler, and hook helpers.AdminWooCommerce admin screens such as Offers, Settings, Tools, Help, and Wizard.ApiREST route registration and controller classes.DataRepositories and session storage adapters.DomainBusiness logic for offers, rules, discounts, storefront rendering, analytics, attribution, cart mutation, logging, and compatibility checks.IntegrationsWooCommerce-specific integrations such as Block Checkout and licensing.UtilsCross-cutting helpers including rate limiting, token handling, and import/export.
Storefront Flow
Section titled “Storefront Flow”At runtime, UpsellBay follows this path:
- An offer is loaded from the private
upsellbay_offerCPT. - Rules and schedule checks determine whether the offer is eligible.
- A placement renderer builds escaped storefront HTML for classic WooCommerce contexts.
- Public REST routes handle accept and dismiss actions using a plugin-issued session token.
- Attribution and aggregate analytics are written server-side.
Block Checkout support follows the same business rules, but uses WooCommerce Blocks integration points instead of classic PHP render hooks.
Public vs Private Contract
Section titled “Public vs Private Contract”External developers should treat these as the supported integration surface:
- Documented hooks and filters
- REST routes under
upsellbay/v1 - Shared identifiers from
Core\Constants - Offer export/import JSON shape
Avoid coupling to:
- The internal container wiring
- Admin page markup or CSS selectors
- Private class construction details
- Direct database writes outside documented storage contracts