Sitecore Commerce 9: Custom Membership Pricing (Part 1)
Sitecore Commerce 9 has powerful Price management feature out-of-the-box. You can configure a default list price for a Sellable Item and a Sellable Item Variant. You can also create a PriceBook and associate it with any catalog. Per each Price Book you can create Price Cards and then create Price Snapshots. Per each Price Snapshot you can create multiple Price Tiers. A more detailed documentation about Price Management Features is here.
Sometimes a business requires some kind of specific price management based on multiple conditions. Today I want to write about widely used feature for ecommerce shops like Membership Pricing. Let’s imagine, we want to have some kind of customer membership levels like Silver, Gold, Platinum, and Regular. Customers can purchase a membership level subscription and get some or all products with a special price. The price can vary depending on a membership level. How can we do this in Sitecore Commerce 9?
First of all, let’s try to find all approaches, which can help us to implement the Membership Level Price Management feature.
The first approach is to use Sellable Item Variants. We can specify a Sellable Item Variant per each Membership Level, create a Price Card per each created variant. Looks easy, right? If we dive deeper, we will find that it works fine even if we have just a few membership levels and the products are always available without any restrictions to product inventory. If we have a dozen membership levels, we will have a dozen variants. It adds some difficulty for content editors to control prices throughout the shop. Content editors need to create variants if the price for the loyalty program member is different from the default. If you already have product variants, split by a parameter like color, size and etc., the number of variants will grow like a snowball. If we need the inventory sets support, we will need to specify a product inventory per each variant of the inventory set and this inventory set can’t be shared between multiple variants. In that case we will have separate inventory sets per each of the membership levels. It also requires some development work on the frontend side, because we need to somehow resolve the customer membership level and add proper product variant to a cart.
The second approach is to create a new entity – a Membership Level Entity. The Membership Level Entity will have a reference to a specific Price Book. Then we can override Price Book resolver and get Price Book by the membership level. As for me, this approach looks more elegant, because you don’t need to change a catalog structure, you don’t need extra variants and, finally, you can specify all catalog prices in a related membership price book. That seems fine, but it also requires to implement membership level entity management in a business tools site to make everything manageable. It will take time to implement.
The third approach is to create custom price tiers, which will extend the OOTB price card management. In that case we need to override a few blocks and add some custom code. We can store the list of membership levels in the policy, where we can easily add new or remove existing levels.
In my future blog posts I want to explain the third approach. You can see how it works on the screenshots below: