Skip to main content

Hide out-of-stock products in abandonment emails

Avoid sending empty messages and improve customer experience by hiding out‑of‑stock products from abandonment emails.

Updated today

Before you start

  • By default, abandonment emails include both in‑stock and out‑of‑stock items.

  • To hide out‑of‑stock products, Fresh Relevance must be collecting stock quantity or stock status for your products.

  • You can combine trigger rules with cart layout filters to prevent sending emails with only out‑of‑stock items.


Method 1: Use the Products rule

  1. In the left side menu, go to Triggers.

  2. Expand the Show options (three dots) menu for the trigger you want to edit and select the Edit icon.

  3. Expand the Raised Browse/Cart Abandon Signal rule group and drag the Products rule to the top of the rule tree on the right, so it's the first entry.

  4. Select the rule to configure and set the options to

    1. all of

    2. Stock

    3. Out of Stock

    respectively.

    If a cart matches that criteria, this means all of the items in it are of out of stock, so you don't want to send.

  5. Select the Add Trigger Program tab and drag the Do Nothing trigger into the Yes branch. Then add any other rules/triggers to the No branch.


Method 2: Check stock before sending each stage

Use this method to re‑check product stock at send time in a multi‑stage trigger:

  1. Enable the Refresh product data at send time option for the stage.

  2. Add the following script to the script box for the stage:

result.proceed = false;

if (helpers.checkCartStock() === true){

result.proceed = true;

}

Example for the second stage email:


Method 3: Filter the cart layout

To hide out‑of‑stock products in the cart layout:

  • modify the product FOR loop and append the below IF statement:

{% for product in products if product.stock > 0 %}

  • If you use an existing filter to limit products, append the IF statement:

{% for product in products|limit(1)|reverse if product.stock > 0 %}

This ensures only products with stock greater than zero are displayed.

Did this answer your question?