Skip to content

When a product is saved

Sends a notification when a Commerce Product has been saved. Covers both new products and updates to existing products.

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.

The "has changed" operator

Field rules now include an additional "has changed" operator, alongside the existing standard options.

When the element is saved, the "has changed" operator checks whether the field's value has changed during the save, (regardless of what the new value is). The notification will only be sent when the specified field's value has changed.

Twig variables

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

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

Examples

Notify the merch team of a new product launch

twig
{{ product.title }} is now live.

- Type: {{ product.type.name }}
- Price: {{ product.defaultVariant.price|commerceCurrency }}
- SKU: {{ product.defaultVariant.sku }}

Skip when the price didn't change

twig
{% if not original %}
    {% skipMessage "Skip on first save - this trigger is for price changes only." %}
{% endif %}

{% if original.defaultVariant.price == product.defaultVariant.price %}
    {% skipMessage "Price unchanged." %}
{% endif %}

{{ product.title }} is now {{ product.defaultVariant.price|commerceCurrency }} (was {{ original.defaultVariant.price|commerceCurrency }}).