Siren

Commerce Events (Reference)

Domain events triggered by e-commerce activity. Sales, refunds, coupons, renewals, and leads.

WordPress plugin

Last updated: October 28, 2026

Commerce events are the entry point into Siren’s attribution pipeline. They fire when something happens in an integrated e-commerce platform: a sale completes, a coupon is applied, a subscription renews, or a form submission arrives. All commerce events live in the Siren\Commerce\Events namespace and implement PHPNomad’s Event interface. See the integration feature matrix for which events each integration supports.

Extensions produce commerce events through transformers. Your extension code does not dispatch these events directly; it returns an event instance from a transformer callback, and the framework broadcasts it. See the Commerce Events extension guide for how to produce these events from your own integration.

How commerce events enter the pipeline

Commerce events follow a consistent path from the e-commerce platform into Siren’s core. An extension registers a transformer that maps a platform hook (such as a WooCommerce order status change) to a commerce event class. When the hook fires, the framework calls the transformer, which constructs the appropriate event instance and returns it. The framework then broadcasts the event through the event bus, where core listeners pick it up and begin processing.

This design means extensions never call the event dispatcher themselves. They declare what platform activity maps to which event, and the framework handles the rest. The result is a clean boundary between platform-specific integration code and Siren’s core attribution logic.

Each event carries the data that downstream listeners need: opportunity IDs for attribution lookup, transaction details for conversion building, binding fields for mapping back to external records, and source identifiers for tracking which extension produced the event.

The typical sale flow looks like this:

SaleTriggered Extension detects a purchase
TransactionCompleted Payment gateway confirms

For coupon-based attribution, the flow is slightly different. The coupon event fires first to establish the engagement, then a subsequent sale event creates the conversion:

CouponApplied Customer uses coupon at checkout
SaleTriggered Sale completes with coupon attribution

Commerce events in this category

SaleTriggered

The primary commerce event for purchases. Fires when an extension detects an order that Siren should track. This event carries the opportunity ID, transaction details, and source identifier, and triggers the conversion pipeline that produces conversions, obligations, and eventually payouts.

TransactionCompleted

Fires when an order reaches its final approved state, typically after the payment gateway confirms the charge. This is separate from SaleTriggered because many platforms create orders before payment clears. Completing a transaction approves its conversions when the program auto-approves, which moves their obligations from draft to approved and makes them eligible for payout. A conversion whose reward is held because the sale is in another currency stays pending.

RefundTriggered

Fires when a whole completed order is reversed, whether through a cancellation, refund, or deletion. Core listeners reject the associated conversions, set the transaction to cancelled, write what the order had left as refund lines, and adjust metric totals so collaborator performance numbers stay accurate. A refund of part of an order fires PartialRefundReceived instead, which writes the refund as refund lines and recalculates the sale’s unpaid rewards. WooCommerce, Easy Digital Downloads, and the refund event route raise it. On Siren Cloud, a Stripe or Shopify refund of part of an order raises it too, and a WordPress site connected to Siren Cloud forwards it.

CouponApplied

Fires when a customer uses a coupon code during checkout. Unlike sale events, this event carries the coupon code and the opportunity rather than transaction details. Siren uses the coupon code to look up which collaborator owns it and creates engagements that a subsequent sale event converts into credited commissions.

RenewalTriggered

Fires when a subscription renewal payment completes. This event traces back to the original purchase transaction so that the same collaborator continues earning commissions on recurring revenue. The conversion process mirrors the initial sale flow but uses the original transaction’s attribution data instead of looking up a new opportunity.

LeadTriggered

The non-monetary equivalent of SaleTriggered. Fires when a form submission or signup action occurs, carrying an opportunity ID and source string but no transaction details. The downstream pipeline creates conversions and obligations using lead-specific incentive types rather than sale-based ones.

Coupon record events

CouponCreated, CouponUpdated, and CouponDeleted fire when a store makes, saves, and deletes or trashes a coupon. CouponsImported fires for each page of up to 100 coupons the one-time coupon rebuild reads. They keep Siren’s coupon records in step with the store’s coupons and don’t touch attribution, which is CouponApplied’s job.

Order discount events

OrderDiscountsDetected fires when an order that used discounts completes, and Siren takes any store credit the order spent from the collaborator’s balance. OrderDiscountsReversed fires when that order is refunded or cancelled, and Siren gives the credit back. The WooCommerce, Easy Digital Downloads, and LifterLMS store credit add-ons fire both. Store Credit Events covers the ledger events they lead to.

Customer record events

These events keep Siren’s customer records in step with the store’s shoppers. Siren keeps a customer only for a shopper who touches its data, such as one who arrived through a referral. Each event carries a CustomerFact, which getFact() returns, and none has a page of its own yet.

  • CustomerIdentified (customer_identified) fires when a shopper Siren saw in a tracked session signs in, or checks out in WooCommerce, Easy Digital Downloads, LifterLMS, or LearnDash. It’s the event that creates a customer, and isOnSale() says whether a sale named the shopper.
  • CustomerCreated (customer_created) fires when someone registers a WordPress account in a tracked session, such as after a referral.
  • CustomerUpdated (customer_updated) fires when a WordPress profile is saved. It changes only a customer Siren already keeps.
  • CustomerDeleted (customer_deleted) fires when a WordPress user is deleted. It marks a customer Siren keeps as deleted, and it isn’t an erasure, because a store can delete an account and keep its orders.
A WordPress site connected to Siren Cloud forwards each of these four events to Siren Cloud.

Product record events

These events keep Siren’s record of each store’s products, which product owners rely on. A core listener writes the record, and nothing waits for an answer. None has a page of its own yet.

  • ProductCreated (product_created) fires when a store makes a product. The WooCommerce, Easy Digital Downloads, LifterLMS, LearnDash, North Commerce, and Gravity Forms integrations raise it. getProduct() returns the StoreProduct, and getPropertyId() is 0 on a WordPress site.
  • ProductUpdated (product_updated) fires when a product changes, such as a rename, a new SKU, or a move to or from the trash. It carries what ProductCreated carries.
  • ProductDeleted (product_deleted) fires when a store deletes a product for good. Siren marks that store’s listing removed and keeps its own product. It carries getIntegration(), getPlatformId(), and getChangedAt().
  • ProductsImported (products_imported) fires for each page of up to 100 products that a product import reads. isLastPage() is true on the last page, and then Siren marks the listings the import didn’t see as removed.
A WordPress site connected to Siren Cloud forwards each of these four events to Siren Cloud.

Listening to commerce events from an extension

Here is a complete example of registering a listener that reacts to SaleTriggered from an extension. The listener uses dependency injection to access the collaborator datastore and a logger.

<?php

namespace Siren\WordPress\Extensions\MyExtension\Listeners;

use PHPNomad\Events\Interfaces\CanHandle;
use PHPNomad\Events\Interfaces\Event;
use PHPNomad\Logger\Interfaces\LoggerStrategy;
use Siren\Collaborators\Core\Datastores\Collaborator\Interfaces\CollaboratorDatastore;
use Siren\Commerce\Events\SaleTriggered;

/**
 * @implements CanHandle<SaleTriggered>
 */
class NotifyOnSale implements CanHandle
{
    protected CollaboratorDatastore $collaborators;
    protected LoggerStrategy $logger;

    public function __construct(
        CollaboratorDatastore $collaborators,
        LoggerStrategy $logger
    ) {
        $this->collaborators = $collaborators;
        $this->logger = $logger;
    }

    public function handle(Event $event): void
    {
        $this->logger->info(
            'Sale triggered for opportunity ' . $event->getOpportunityId()
            . ' from source ' . $event->getSource()
        );
    }
}
use PHPNomad\Events\Interfaces\HasListeners;
use Siren\Commerce\Events\SaleTriggered;
use Siren\WordPress\Extensions\MyExtension\Listeners\NotifyOnSale;

class MyExtensionInitializer implements HasListeners
{
    public function getListeners(): array
    {
        return [
            SaleTriggered::class => NotifyOnSale::class,
        ];
    }
}

The listener is resolved through the DI container when the event fires, so CollaboratorDatastore and LoggerStrategy are injected automatically. See the Listeners & Event Handlers guide for more patterns and details on writing listener classes.

Your privacy choices

Account, checkout and chat you request work without optional tracking. Choose whether to allow these other uses on this website.

You can change or withdraw your choices at any time using “Privacy choices.” We remember your choice for 180 days. Read our privacy policy.