1

This is a followup to this question: Sitecore Commerce Member Type Pricing.

I want to vary pricing by member type as well as by geography. I started going down the road of attempting to use price cards to provide functionality. I would create different pricing cards and then figure out how to assign the pricing card given the context.

On my initial import, I come up with 220 different price cards. I think this would be impossible for merchandisers to work with. Do we go to a card per product per pricing attribute; which would create more price cards, but make them more identifiable to a user? There is no search that I see in the price card section, so I think this would still be difficult.

I could add an Entity View on sellable items that would have additional pricing attributes. I think that would work OK for one currency, but this is a customer that wants to sell in multiple currencies. Also, I think if we did this, we basically would have to not use pricing cards at all.

Has anyone ever tried to override the List Price component to include pricing attributes? Or overriding PriceTier in PricingSnapshot Component?

2
  • Hey Jonathan, have you found the way to do so? Just having the same requirement Commented Nov 5, 2018 at 14:06
  • @MartinMiles, yes I have. I think there are a couple of ways to do it. I will post here in the next few days the method I used. Commented Nov 5, 2018 at 21:46

1 Answer 1

3

So I resolved the problem as follows. First in the commerce solution, I added a pricing plugin. In the pricing plugin, I created two components a SellableItemPriceModifiersComponent and a CartMemberTypeComponent.

On create of a sellable item, I add the SellableItemPriceModifiersComponent to the components. This is where information was stored about the different prices by user type. On user login, I would add a CartMemberTypeComponent to Cart.

I added a CustomCalculateCartLinesSubTotalsBlock that runs in the ICalculateCartLinesPipeline pipeline. CustomCalculateCartLinesSubTotalsBlock checks for the existence of a CartMemberTypeComponent and if present modifies the calculation of the cart line totals using the SellableItemPriceModifiersComponent if present.

Then, I needed to be able to add the CartMemberTypeComponent to the cart when a user logs in. To do this again in the commerce solution, I added CommandsController with an AddUserCartMemberTypeComponent method. This would take a parameter of the cartId and some member type variables. It would find the cart, create the component, and add to the cart.

I then from the Client Web Application needed to be able to call the AddUserCartMemberTypeComponent method. To do this, I used the Sitecore.Commerce.Proxy project where I updated the connected service odata for the commerce application. This created the end point for my AddUserCartMemberTypeComponent.

In order to call upon login, I overrode the Login method in the Sitecore.Commerce.XA.Foundation.CommerceEngine.Managers.AccountManager class. At the end of the method, I added a call to a new method AddUserPricingPropertiesToCart on a CustomCartManager class modeled after the Sitecore.Commerce.XA.Foundation.Connect.Managers.CartManager class. This calls into a CustomCartServiceProvider which called a custom pipeline.

The pipeline had one processor UpdateUserPricingProcessor, which inherited from Sitecore.Commerce.Engine.Connect.Pipelines.Carts.CartProcessor. The UpdateUserPricingProcessor called into the AddUserCartMemberTypeComponent command through the Sitecore.Commerce.Proxy.

That is how I did it. It was a bit of an effort.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.