Skip to content

When a product is deleted

Sends a notification when a Commerce Product has been deleted.

This trigger fires for both soft deletes (moved to the trash) and hard deletes. Restoring a deleted product fires the separate "When a product is restored" event.

Requires Craft Commerce

Only available when the Craft Commerce plugin is installed.

Product Type Filters

Choose which Commerce product types should fire this notification. Only products of the selected types will trigger it.

Selection is required

Check at least one product type, or the notification won't fire.

Field Conditions

Field conditions restrict the notification based on the element's content, using Craft's native conditions framework. Build a rule set against the element's attributes and field values, and the notification will be sent only when every rule matches.

Must match all conditions

The condition builder evaluates every rule with AND semantics, so each rule must pass for the notification to be sent.

Twig variables

The object variable (and its product alias) is the deleted Product.

twig
"{{ product.title }}" was just deleted.

Examples

Alert administrators of a deletion

twig
{{ product.title }} was deleted by {{ currentUser.fullName }}.

- Type: {{ product.type.name }}
- SKU: {{ product.defaultVariant.sku }}

Skip deletions in a specific product type

twig
{% if product.type.handle == 'archived' %}
    {% skipMessage "Archived products are not announced." %}
{% endif %}

Deleted: {{ product.title }}