New promotion system with old order system

Vote:
 

We are on commerce 11.4, but have not migrated to the new order system.

I was wondering if it was possible to use the old order system (with CartHelper) with the new promotion system (where you set campaigns etc. under the "Marketing" tab)?

So far I am unable to apply any created item discounts to the cart. I thought it would be done automatically under-the-hood of EpiServer, but even after removing all of our custom workflows the full price of an item is added to the cart rather than the sale price.

I know the promotion was created properly because I can see the correct discount price when using:

promotionEngine.GetDiscountPrices(variation.ContentLink, currentMarket.GetCurrentMarket(), organization.GetPreferredCurrencyCode())

I've tried adding this code when adding to the cart:

promotionEngine.Run((IOrderGroup)cartHelper.Cart, new EPiServer.Commerce.Marketing.PromotionEngineSettings());
cartHelper.Cart.AcceptChanges();

I've tried adding the following to the ecf.app.config file:

  
    
  

But the above didn't work.

If I add back in our custom workflow stuff hooked into CartValidateWorkflow, the lineItem.Discounts is empty from the lineItem from the orderForm.

I have also tried cloning the latest version of the QuickSilver repo that still had the old order system (7c4f5afccd9966c68fe65872f6456a5cde64379a on August 12), however this commit unfortunately is uses the old promotion system.

Any advice would be greatly appreciated!

Thanks,

Jordan

#187151
Jan 15, 2018 5:34
Vote:
 

I can be wrong here, but the new promotion system does not know or care about CartHelper. As long as you have a valid cart which satisfies the conditions, it should apply. However:

  • the cart must have at least one shipment, and the LineItems are assigned to them.
  • The new promotion system works with IOrderForm.Promotions. it does not know or care about LineItem.Discounts.

Note that CartHelper is obsoleted in Commerce 11.6.1, and we recommend to use the new APIs as soon as possible.

#187155
Jan 15, 2018 8:21
Vote:
 

Hi Quan,

Thanks for your response. Would you still expect there to be any Promotions on the orderform if we only have item discounts?

They have a shipment I believe. My only hope right now might be to add the use of promotionEngine.GetDiscountPrices to a custom workflow and recalculate the total and line item prices within it but I am reluctant to do that.

Is there anything else that it could be?

#187205
Jan 16, 2018 5:41
Vote:
 

Yes, IOrderForm.Promotions will contain everything, including entry, shipment or orderfrom promotion information.

The builtin workflows were already upgraded to use the new promotion system internally if you configure to use it. Just to make sure that you have the settings in both CMS site and Commerce Manager site. 

#187219
Jan 16, 2018 12:15
Vote:
 

Hi Quan,

Ah I accidentally hadn't configured it in both sites, only the Commerce. Now the line item promotion shows up on the IOrderForm!

However with WorkflowsVNext enabled to get that working, the following code does not work anymore

cartHelper.Cart.RunWorkflow("CartPrepare")

It is calling the default EpiServer CartPrepare workflow, and the line items in the cart are all removed when it is run, can you explain that?

#187254
Jan 17, 2018 0:17
Vote:
 

If you use OrderGroupWorkflowManager to run the workflow, it should return a WorkflowsResult which contains warnings/reasons on why lineitems were removed. In your case it's likely that the lineitems were not in a shipment.

#187260
Jan 17, 2018 6:43
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.