Skip to main content

Smart Flows Discount Step: Apply a Shopify Discount Code When a Flow Runs

Use the Smart Flows Discount step to apply a discount code you created in Shopify, and how product and order codes behave in a flow.

Written by Tom
Smart Flows Discount Step: a Smart Flow where a Cart Subtotal targeting rule of $100 or more leads to a Discount step that applies the Shopify code DISCOUNT15 for 15% off the order

The Smart Flows Discount step applies a discount code you already created in your Shopify admin to the shopper's cart when a flow reaches that step. Rebuy does not create the discount for the Discount step, so the code's type, value, and eligibility all come from Shopify. The Smart Flows Discount step is also called the Discount component or the Discount node, and all three names refer to the same Discount step in the Promotions group of the flow editor's Add Step panel. Use this article to set up the Smart Flows Discount step, choose between an order discount code and a product discount code, and understand how the code works alongside Rebuy's own discounts.

What the Smart Flows Discount step does

The Smart Flows Discount step takes a Shopify discount code and applies it to the cart automatically, so the shopper never has to type it at checkout. The flow decides when the shopper receives the code, and Shopify decides what the code is worth and which products or orders it covers.

The Smart Flows Discount step can apply any type of discount code you can create in Shopify, including an amount off products, an amount off the order, and free shipping. The Smart Flows Discount step's sidebar holds the Discount code field, and nothing about the discount's value can be changed from Smart Flows.

The Smart Flows Discount step has an After Added branch, so a step connected after it, such as a Popup Message telling the shopper about the discount, runs once the Discount step has tried the code. The After Added branch runs whether or not the code applied, so confirm the code works in Shopify before pointing a message at it.

Smart Flows Discount Step, example flow: a Returning Users targeting rule whose If True branch applies the discount15 code with a Discount step, followed on the After Added branch by a Popup Message telling the shopper they earned 15% off

Which Smart Flows steps create a discount and which apply a Shopify code

Smart Flows discounts reach the cart in different ways depending on the step. The Add Items to Cart and Buy X Get Y steps create a discount inside Rebuy on each product they add, such as Free or Percentage Off, with nothing to set up in Shopify. The Smart Flows Discount step never creates a discount, and instead applies a discount code that you created in your Shopify admin.

The following table shows, for each Smart Flows promotion step, where its discount is set up and how that discount reaches the shopper's cart.

Smart Flows step

Where the discount is set up

How the discount reaches the cart

Add Items to Cart step

In the Smart Flow, with the At Discount setting on each product the step adds

Rebuy applies it to the added product through the Rebuy Product Discount, a Shopify Functions discount Rebuy creates for you

Buy X Get Y step

In the Smart Flow, with the At Discount setting on each reward product in the Get Y section

Rebuy applies it to the reward product through the Rebuy Product Discount, a Shopify Functions discount Rebuy creates for you

Discount step

In your Shopify admin, as a discount code you create before building the flow

The Smart Flows Discount step applies your existing Shopify discount code to the cart when the flow reaches it

An order-level discount in a Smart Flow comes from a Shopify order discount code that you create in your Shopify admin and the Smart Flows Discount step applies, since the Add Items to Cart and Buy X Get Y steps discount only the products they add.

Some other Smart Flows fields have Discount in their name and apply no discount. The Discount Message field next to At Discount in the Add Items to Cart and Buy X Get Y steps adds a message to the item once it is in the cart, and it applies no discount itself. The Smart Flows Dynamic Messaging Discount code and Discount value tokens show the Smart Flows Discount step's code and value in Website Banner or Popup Message text, and they apply no discount themselves.

For every promotion step's settings, see Smart Flows Settings Explained.


Set up the Smart Flows Discount step

Setting up the Smart Flows Discount step starts in Shopify, since the step can only apply a code that already exists there, and finishes in the Smart Flows editor.

Create the discount code in Shopify for the Smart Flows Discount step

The discount code for a Smart Flows Discount step is created and managed in your Shopify admin, not in Rebuy.

  1. In your Shopify admin, go to Discounts and create the discount code, setting its type, value, eligible products or orders, and dates.

  2. Make sure the code is active in Shopify. A scheduled code that has not started yet, or an expired code, has nothing to apply.

Shopify's note under the code field that customers must enter the code at checkout does not apply to shoppers who reach the Smart Flows Discount step, since the step applies the code to their cart for them.

Smart Flows Discount Step, create the code in Shopify: an active Shopify Amount off order discount code named discount15 for 15% off the entire order, set to combine with product discounts, ready to enter in a Smart Flows Discount step

Add the Smart Flows Discount step to your flow

The Smart Flows Discount step is added from the Promotions group of the flow editor's Add Step panel.

  1. In the Rebuy admin, go to Flows and A/B Testing, then Smart Flows, and open the flow.

  2. Click the plus icon on the branch that should give shoppers the code, such as If True on a targeting rule, or click Add Starting Step to start the flow with the Discount step.

  3. In the Add Step panel, select Discount in the Promotions group.

Smart Flows Discount Step, add the step: the Smart Flows Add Step panel with the Promotions group open, showing the Discount step listed between Add Items to Cart and Buy X Get Y

Enter the discount code and turn the Smart Flows Discount step on

The Smart Flows Discount step's sidebar holds the Discount code field, where you enter the Shopify code the flow applies.

  1. Select the Smart Flows Discount step on the canvas and enter the code in the Discount code field, as it appears in your Shopify admin. The step then shows the code on the canvas.

  2. Click Save, then turn on the flow's Live toggle.

  3. Test the flow on your storefront through checkout and confirm the discount appears on the order. If it does not, check the code's status and eligibility in Shopify, then test again in a new browser session.

Smart Flows Discount Step, enter the code: the Discount step sidebar with discount15 typed in the Discount code field, next to a canvas where a Returning Users targeting rule leads to the Discount step on its If True branch


Use an order discount code in a Smart Flow

An order discount code, such as 10% off the entire order, discounts the whole cart when the Smart Flows Discount step applies it. To give an order-wide discount from a Smart Flow, create the order discount code in your Shopify admin and enter it in the Smart Flows Discount step, since the Add Items to Cart and Buy X Get Y steps discount only the products they add.

The Smart Flows Dynamic Messaging Discount value token shows the applied order discount in a banner or popup, for example 10% or $5.00. See Smart Flows Dynamic Messaging: Show Live Cart Values in Banners and Popups.


Use a product discount code in a Smart Flow

The Smart Flows Discount step can apply a product discount code, such as 20% off the products in specific collections. A product discount code applied by the Smart Flows Discount step discounts every eligible product in the cart, including products the shopper chose themselves, because the code's eligible products are set in Shopify and not in the flow. The Add Items to Cart and Buy X Get Y steps discount only the products they add, so which one fits depends on which products your promotion should reach.

What happens when the cart has no eligible product yet

A product discount code applied by the Smart Flows Discount step stays on the cart even when the cart holds no product the code covers yet, and Shopify applies it automatically as soon as an eligible product is added. Until then, a Rebuy Smart Cart shows a message under its discount code field, such as SALE20 is not valid for this cart. Once the shopper adds a product from the code's collections, the code shows as applied in the Smart Cart and the product shows its discounted price.

Does the Smart Flows Discount step remove a product discount code when the shopper no longer meets the Cart Subtotal condition?

No, the Smart Flows Discount step does not remove a product discount code once it has applied it, even when the shopper no longer meets the Cart Subtotal targeting rule that led to the step. The Smart Flows Discount step has no setting that removes its code, unlike the If Trigger Fails setting on the Add Items to Cart and Buy X Get Y steps, which can remove the products those steps added.

The following table shows what the shopper's cart looks like in a flow where a Cart Subtotal targeting rule of is greater than or equal to $100 leads to a Smart Flows Discount step with a Shopify code for $20 off a specific collection.

What happens in the cart

Cart total

Product discount code

The shopper adds one $100 collection product and the flow applies the product discount code

$80

Stays applied, even though $80 is below the $100 threshold

The shopper reaches $100, receives the product discount code, then removes everything except one $50 collection product

$30

Stays applied on the remaining collection product

To keep the discount in line with your flow, match the conditions on the Shopify discount code to the targeting rules that lead to the Smart Flows Discount step, since only the code's own conditions in Shopify decide whether it keeps discounting the cart after the flow applies it. Use the following settings in your Shopify admin:

  • For a Cart Subtotal targeting rule, give the code a minimum purchase amount equal to the threshold under Minimum purchase requirements, such as $100 for a rule of is greater than or equal to $100.

  • On a code that applies to specific collections or specific products, Shopify counts only those products toward the minimum purchase amount, so the minimum can differ from the whole-cart total the Cart Subtotal targeting rule checks. Test the promotion with carts above and below the threshold before turning the flow on.


Combine the Smart Flows Discount step code with Rebuy discounts and other Shopify discounts

A Shopify discount code applied by the Smart Flows Discount step follows Shopify's discount combination settings, the same as a code a shopper types in. Rebuy's own discounts, including the product discounts that Add Items to Cart and Buy X Get Y apply, are set to combine with other discounts by default, but Rebuy cannot change the combination settings on your Shopify codes.

To let the Smart Flows Discount step's code apply alongside a Rebuy product discount, open the code in your Shopify admin and allow it to combine with product discounts in its Combinations settings. Without that setting, Shopify can drop one of the discounts at checkout.

When a product discount code from the Smart Flows Discount step and a Rebuy product discount land on the same product, Shopify applies only one product discount to that product, keeping the one worth more to the customer, unless your store is on Shopify Plus with discount stacking set up. On Shopify Plus, turn on Enable discount stacking under Settings > Discount Combinations in the Rebuy admin, as described in Discount Combinations: Stack a Rebuy Discount and a Shopify Discount on the Same Product. For more on how Rebuy discounts combine, see Rebuy Discounting Overview.


Shopify automatic discounts and the Smart Flows Discount step

A Shopify automatic discount does not use the Smart Flows Discount step, because the Discount step only accepts a discount code. Shopify applies an automatic discount on its own whenever the conditions set on it in Shopify are met, whether or not a Smart Flow runs, so a Smart Flow cannot turn an automatic discount on or off. To promote a Shopify automatic discount with Smart Flows, add a Website Banner or Popup Message step that tells shoppers about the offer, or an Add Items to Cart step that offers the products it covers.


When the Smart Flows Discount step code does not apply

A Smart Flows Discount step code does not apply when the code does not exist in your Shopify admin, has expired, has not started yet, or has been deactivated. The flow records the code as applied for the shopper's session whether or not it worked, and it does not try the code again during that session. A banner naming the code can then show while checkout charges full price.

To fix a code that did not apply, use the following checks:

  • Confirm the code exists in your Shopify admin under Discounts, is active, and matches the code in the Discount code field.

  • Confirm the code's eligibility in Shopify covers what the shopper has in their cart.

  • Test again in a new browser session, since the flow does not retry the code in the session where it failed.


FAQs

Does Rebuy or the Smart Flows Discount step create the discount code, or do I create it in Shopify?

Rebuy does not create discount codes, and the Smart Flows Discount step does not create a discount, so you create the discount code in your Shopify admin and the Smart Flows Discount step applies it to the shopper's cart. Create the code in Shopify first, including its value and which products or orders it covers, then enter it in the Smart Flows Discount step's Discount code field, and the flow applies it when the shopper reaches the step. Every discount code a Smart Flow applies, including order discount codes and product discount codes, is one you created in Shopify.

The discounts Rebuy creates in Smart Flows are the product discounts you set on each product the Add Items to Cart and Buy X Get Y steps add, which Rebuy applies automatically through its own Shopify Functions discount without a discount code.

Can the Smart Flows Discount step apply a product discount code?

Yes, the Smart Flows Discount step can apply a product discount code, and Shopify discounts every eligible product in the cart according to how the code is set up in Shopify. The code stays on the cart until the shopper adds a product it covers, and Shopify applies it then. The Add Items to Cart and Buy X Get Y steps discount only the products they add, so which one fits depends on which products your promotion should reach.

Did this answer your question?