Sitecore Commerce 9: Custom Membership Pricing (Part 2)

Andrei Paliakou on October 7, 2019

Sitecore Commerce 9: Custom Membership Pricing (Part 2)

In my previous blog post, I explained a few ways of how Custom Membership Pricing can be implemented in Sitecore Experience Commerce 9 (XC9). Now I will explain how I extended XC9 and created custom price tiers, which, in their turn, extended the OOTB price card management. In this case we’ll need to override a few blocks and add some custom code.

Sitecore Commerce Price Card can have multiple Price Snapshots. Price Snapshot can have multiple Price Tiers. In my solution I didn’t extend OOTB Price Tier, but created a new type of Price Tier - Custom Price Tier. It means that we can use OOTB logic together with our new extensions.

I created MembershipTiersComponent for Price Snapshot, which can have list of Custom Price Tiers:

Custom Price Tier has almost the same list of properties as OOTB Price Tier, but with extra MembershipLevel property:

We need to manage the list of Membership Levels somewhere, right? Sitecore Commerce Policy is a proper way to do that - I’ve created Membership Level Policy, as well as json environment configuration. Now we can manage the list of Membership Levels in PolicySet json file. If you decide to update this list, don’t forget to re-bootstrap your Commerce Engine.

All basic preparations are done. After that I created the required stuff for Custom Price Tiers management, because we need to have similar possibility to add, remove, edit Custom Price Tiers from Business Tools.

I implemented the required ViewBlocks and ViewAction blocks in the same way like we have it OOTB for Price Tiers.

After all these preparations you should able to see a new section in Business Tools--CustomPrice--and be able to manage prices for Membership Levels.

You can find this MembershipPricing plugin on GitHub:

In my next blog post I will explain how Membership Prices can be applied during Cart Calculations.