Create a Cart Price Rule

Cart price rules apply discounts to items in the shopping cart, based on a set of conditions. The discount can be applied automatically when the conditions are met, or when the customer enters a valid coupon code. When applied, the discount appears in the cart under the subtotal. A cart price rule can be used as needed for a season or promotion by changing its status and date range.

Who is this video for?

  • eCommerce marketers
  • Website managers

Video content

Transcript
Hello today, I’ll show you how to set up cart price rules in Commerce. First thing we do is navigate to our dashboard, which shows us existing cart price rules. These types of rules apply discounts to items in the shopping cart based on various conditions that you define. And today we’ll be setting up a new rule.
And our discount will take 20% off the entire order and the shipping charge as long as you buy at least $100 worth of merchandise. You can type in an optional description, set it to active or not. I’ll select my website. You can pick and choose the applicable customer groups. I’ll select all of them. For coupons, you can do “no coupon” which will apply this discount automatically. You can do “auto-generated coupons,” or just specify a value, which we will do for this use case. You can also set a priority. And we come down to the conditions section. So in this section, our only condition for our discount is that the subtotal must be at least greater than or equal to $100.
Then we come to the actions. This is what happens when the condition has been met. In our case, we want a percentage discount. Our percentage is 20. And we want to apply it to the shipping amount as well. So as it stands, our discount will only apply to the order subtotal or, thought of another way, all the items in the cart. When we enable this toggle, it will apply to all the items in the cart plus also the shipping charge in addition to that.
This section is empty, meaning all items in our cart are eligible.
Additionally, you can define labels for different store views. You can manage coupon codes, which we don’t need in this case. You can also attach related dynamic blocks to the promotion, which we won’t do in this case. I will save the rule. And we will head to the storefront to check on it. I will open my cart. You can see I’ve got some products already in here. I already entered a shipping address, so it calculates a shipping charge. And I’ll attempt to apply my coupon.
Now we see that the coupon code is invalid. Why is it invalid? Because our subtotal does not match the minimum. We can raise the quantity of our products to make it an even 100 and apply the discount code again.
And while it’s doing that, we can calculate 20% off $100 is $20, and 20% off of $15 is $3. So 20 plus 3 gives us a $23 discount on our order, which comes from the order subtotal and the shipping charge. And that’s how you create a cart price rule in Commerce. For detailed information, please visit the Commerce user guide in Adobe Experience League. -

Pricing display issues

There are some unique scenarios that require each line item to display their discount provided but the values may not match exactly. The reason is when a cart price rule discount is applied to multiple products but the values do not evenly divide into two decimal places.

recommendation-more-help

Cart Price Rule = 10% discount applied to 2 products in the cart
Condition for price rule to take effect: total items in cart is 2
Actions apply percent of product price discount and that discount amount is 10

2 items are added to the cart, each are $19.95

To get the discount amount multiply the product price times 0.1

19.95 x 0.1 = 1.995

This is the issue, we have 3 decimal places, instead of two. Converting this to dollars is now a problem

The solution

Thinking about the website owner, who is the only person affected by this issue, it was determined that showing each item ordered with the discount provided in dollars was the most appropriate. To ensure that the entire order amount calculated properly, it was decided to round up the first item and the others drop the third decimal. Review this scenario:

Same 10% discount as above cart rule in effect
Add 2 products to the cart that are 19.95

Each product should get $1.995 in discounts
Product 1 - 19.95 x 0.1 = 1.995
2 - 19.95 x 0.1 = 1.995

A grand total of 3.99 is provided as a discount to the customer

When displaying the line items to the store owner in the admin,
we need to adjust the first item and round it up to 2.000. The second items we drop the third decimal
Product 1 = 2.00
Product 2 = 1.99

The total discount of the two products now when summed together match the actual discount provided to a customer.

Here is a screenshot as it would show in the admin for an order that has this scenario:

Admin view showing ordered items with different values

Other potential solutions and why they were not used

Same 10% discount as above cart rule in effect
Add 2 products to the cart that are 19.95

Each product should get $1.995 in discounts,
however if we just round them up, it shows too much discount.

Product 1 - 19.95 x 0.1 = 1.995
Product 2 - 19.95 x 0.1 = 1.995

Convert to round up all items
Product 1 New value is 2.00
Product 2 New value is 2.00

A grand total of 3.99 was actually provided as a discount to the customer,
however if we round up, it would show that $4.00 was given, and that is incorrect.

2.00 + 2.00 = $4.00

Similar issue if the third decimal was dropped for all items, it would show too little discount provided.

Same 10% discount as above cart rule in effect
Add 2 products to the cart that are 19.95

Each product should get $1.995 in discounts, however if we just drop the third decimal, this happens:
Product 1 - 19.95 x 0.1 = 1.995
Product 2 - 19.95 x 0.1 = 1.995

Convert to drop the third decimal for all items
Product 1 New value is 1.99
Product 2 New value is 1.99

A grand total of 3.99 was actually provided as a discount to the customer,
however if we drop the third decimal, it would show that $3.98 was given, and that is incorrect.

1.99 + 1.99 = $3.98

Additional resources

3a5f7e19-f383-4af8-8983-d01154c1402f