Skip to content

When a product is saved

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

For events around customers buying a Digital Product (license created, key granted), use the "When a license is saved" trigger instead.

Requires Digital Products

Only available when the Digital Products plugin is installed.

Digital Product Type Filters

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

For license events, the filter checks the parent product's type instead.

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 Digital Product.

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

Examples

Announce a new digital product

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

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

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.price == product.price %}
    {% skipMessage "Price unchanged." %}
{% endif %}

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