Skip to content

Discounts events

Discount management

The events below are dispatched when managing discounts:

Event Dispatched by
BeforeCreateDiscountEvent DiscountServiceInterface
CreateDiscountEvent DiscountServiceInterface
BeforeDeleteDiscountEvent DiscountServiceInterface
DeleteDiscountEvent DiscountServiceInterface
BeforeUpdateDiscountEvent DiscountServiceInterface
UpdateDiscountEvent DiscountServiceInterface

Form events

Form

The events below allow you to customize the discounts creation wizard:

Event Dispatched by
CreateDiscountCreateStructEvent DiscountFormMapperInterface
CreateDiscountUpdateStructEvent DiscountFormMapperInterface
CreateFormDataEvent DiscountFormMapperInterface
MapDiscountToFormDataEvent DiscountFormMapperInterface

Form steps

The following events are dispatched when rendering each step of the discount wizard, allowing you to add new fields to it:

Event Event name
CreateFormDataEvent ibexa.discounts.form_mapper.<step_identifier>.create_form_data
MapCreateDataToStructEvent ibexa.discounts.form_mapper.<step_identifier>.map_create_data_to_struct
MapDiscountToFormDataEvent ibexa.discounts.form_mapper.<step_identifier>.map_discount_to_form_data
MapUpdateDataToStructEvent ibexa.discounts.form_mapper.<step_identifier>.map_update_data_to_struct

The event classes are shared between steps, but they are dispatched with different names. Each step form mapper dispatches its own set of events.

Form mapper Step identifier
ConditionsMapperInterface conditions
GeneralPropertiesMapperInterface general_properties
ProductConditionsMapperInterface products
UserConditionsMapperInterface target_group

Back office

These events are dispatched by the back office controllers after user chooses the "Save" action when creating or updating a discount.

Event Dispatched by Description
PreDiscountCreateEvent Ibexa\Bundle\Discounts\Controller\DiscountCreateController Dispatched when the discount creation is finished in the back office form
PreDiscountUpdateEvent Ibexa\Bundle\Discounts\Controller\DiscountEditController Dispatched when the discount modifications is finished in the back office form

Discount codes

The event below allows you to inject your custom logic before the discount code is applied to a product in cart:

Event Dispatched by Description
BeforeDiscountCodeApplyEvent Ibexa\Bundle\DiscountsCodes\Controller\REST\DiscountCodeController Dispatched before a discount code is applied in the cart