Skip to content

Hooks & Filters

UpsellBay exposes hooks at service boundaries, not inside every internal class.

All documented hook names use the upsellbay_ prefix.

HookPurposeSignature
upsellbay_offer_schemaExtend normalized offer defaults.(array $defaults): array
upsellbay_available_placementsExtend placement labels for integration UIs.(array $placements): array
upsellbay_placement_config_positionsAdjust predefined placement position labels.(array $positions): array
upsellbay_offer_query_argsAdjust offer repository query args.(array $query_args, array $filters): array
upsellbay_rule_contextAdd server-derived values to rule evaluation.(array $context): array
upsellbay_rule_resultOverride one normalized rule result.(bool $result, array $rule, array $context): bool
upsellbay_eligible_offersAdjust eligible offers after validation and prioritization.(array $offers, string $placement, array $context): array
upsellbay_render_offer_htmlAdjust already-escaped storefront markup.(string $html, array $offer, string $placement, array $context): string
upsellbay_offer_priceAdjust the server-calculated offer price.(string $offer_price, string $original_price, array $meta): string
upsellbay_discount_amountAdjust the server-calculated discount amount.(string $discount_amount, string $original_price, string $offer_price, array $meta): string
upsellbay_attribution_metaAdd non-PII attribution data before WooCommerce CRUD writes.(array $meta, array $offer, string $placement): array
upsellbay_analytics_eventAdjust aggregate analytics payloads before persistence.(array $payload): array
HookFires whenSignature
upsellbay_offer_createdA validated offer is created.(int $offer_id, array $offer): void
upsellbay_offer_updatedA validated offer is updated.(int $offer_id, array $offer): void
upsellbay_offer_deletedAn offer is deleted.(int $offer_id): void
upsellbay_offer_renderedA storefront placement renders an offer.(int $offer_id, string $placement, array $offer, array $context): void
upsellbay_offer_acceptedA shopper accepts an offer through a public route.(int $offer_id, string $placement, array $result): void
upsellbay_offer_dismissedA shopper dismisses an offer for the current session.(int $offer_id, string $placement): void
upsellbay_attribution_writtenAttribution data is written to a WooCommerce object.($item, array $meta, array $offer, string $placement): void
upsellbay_follow_on_order_createdA thank-you follow-on order is linked to its source data.($order, int $source_order_id, int $source_offer_id): void
upsellbay_daily_stats_reconciledA daily aggregate row is repaired or reconciled.(string $date, int $offer_id, string $placement): void
HookPurposeSignature
upsellbay_export_payloadAdjust the portable export envelope.(array $payload, array $offers): array
upsellbay_import_mappingNormalize product mapping before resolution.(array $mapping, array $offer, int $index): array
upsellbay_import_sku_matchResolve a product ID from a portable SKU.(int $product_id, string $sku, array $mapping, array $offer): int
upsellbay_import_post_statusChoose the imported post status.(string $post_status, array $offer, int $index): string
upsellbay_import_validation_errorsAdd validation errors without bypassing import rules.(array $errors, array $payload): array
  • Treat hook inputs as untrusted unless they were produced server-side by UpsellBay.
  • Do not bypass capabilities, nonces, session-token validation, or server-side pricing rules.
  • Keep custom attribution and analytics data non-PII.