How-ToSitecore

Sitecore Commerce 9 - An issue with promotion discounts. They are saved as a draft but apply to cart.

Sitecore Experience Commerce (XC) 9 has the Promotions feature OOTB, which enables you to create and manage promotions via the BizFx site. This resource explains how to work with promotions in detail.

When I worked with promotions last time, I had a weird situation, which looked like a bug. What I did is I created a new promotion, added qualifications and benefits. I would like to highlight that I didn’t create public or private coupons and I didn’t approve the promotion, it was saved as a draft. Then I added several products to the cart, applied the promo, and...I got a discount. Just to remind you, I didn’t approve the promotion yet. Then why did I get a promotion discount?

After some research, I found this in the XC documentation:
However, you can test a promotion in your authoring environment before you send it through the approval process.

Usually, if you work with XC, you have an on-premises installation of it with a default Storefront site. Based on the default configuration, Sitecore Experience Platform is configured to communicate with XC in CommerceAuthoring role. This configuration located in sxa.storefront.com\App_Config\Include\Y.Commerce.Engine\Sitecore.Commerce.Engine.Connect.config


In a standard installation it points to CommerceAuthoring role. It means that the Commerce Engine would likely retrieve the data directly from the database to provide the most recent information. You can find more info about the Commerce Engine environments here.

After that, I tried to re-configure XP to communicate with CommerceShops role and checked cart again. A promotion discount was not applied and this is what I expected initially. But why does it work for CommerceShops, but doesn't work for CommerceAuthoring?

Now, the answer is simple. CommerceAuthoring and CommerceShops environments have GlobalPromotionsPolicy:

You can re-configure and set the value of PromotionsRequireApproval as “true” in the CommerceAuthoring role. Then, run a Bootstrap request via Postman to apply the changes in the XC configuration.

I hope someone who has the same issue finds this useful.