Senior Director &National Competency Lead – Sitecore Commerce
Sitecore OrderCloud: Discounted Pricing for products on Sale
Sitecore OrderCloud provides an easy way to support “On Sale” pricing using Price schedules. During holiday periods, it’s quite common for businesses to put their products on sale and offer discounted pricing to their customers. Since these "On Sale" events only last for a limited time, Sitecore OrderCloud makes it very easy to configure this, instead of jumping through a lot of hoops to achieve the same results.
Before getting into the details, review Sitecore OrderCloud documentation around Price Schedules to get a basic understanding of why we need Price schedules.
In short, a Price Schedule is the one that holds the product price information. Even though your product is associated to a catalog and a default user, you cannot purchase that product without associating it to a Price Schedule. Price schedules can be set up at the Buyer level or at an even more granular level such as the User Group level.
In this blog, I will demonstrate an example of a recently introduced Sitecore OrderCloud functionality on how to achieve a Sale Price using Price Schedules.
Step 1: Create a product. In my example, I am using Bookshelf speakers from the demo storefront.
Step 2: Create a price schedule
Step 3: The default price for the product is $120.00
When we go to the storefront and access the Product Details page, the same price will be reflected.
When we add this product to the cart, the price is also set to $120.00
Now, let's set up this product to go on sale.
First, we'll fetch the existing price schedule set up for this product and run a PATCH operation. In this call, we will add a new Price break with Quantity = 1, Price = 120 (Default Price) and Sale Price = 110
We will also add the sale start date (Jan 1st, 2022) and sale end date (Dec 31st, 2022). This would tell OrderCloud engine when to apply the discount.
The code will look something like this:
Now, if we go back to the storefront and update the cart landing page, we will see that the price got updated to the Sale Price of $110.00
It is as simple as it looks. This is a native functionality of Sitecore OrderCloud. Stay tuned for more interesting blog posts around Sitecore OrderCloud.
A few things to note here as part of this feature are,
1. You can create as many price breaks as you want under a Price Schedule
2. The Sale Price will only go into effect when you provided a valid value
3. The Sales Start Date and Sales End Date are optional fields
- If you don’t provide them, it goes into effect indefinitely
- They only need to be provided if you would like to limit this promotion period to a limited time