Vendr checkout - update shipping method prices to reflect discounts
Hi,
I am using Vendr 2.1.2 and Vendr.Checkout 2.1.0. I'm trying to use a ShippingCalculator to update the price displayed for shipping methods on the shipping method selection stage.
This is so that users can see the actual shipping method cost before they select which one they want.
My idea is to calculate all price adjustments to shipping and deduct that from the original shipping method price (for the current currency) for each shipping method and display the adjusted price to the user.
We have an automatic discount in place for orders over a certain value. I can see that discount is being applied to the order at the shipping selection stage, but cannot see the adjustment value(s).
The below screenshot shows that the Order has a zero value for the 'Adjustment' properties on ShippingInfo.TotalPrice. The same issue applies to each of the 'Price' objects in the 'Adjustments' property of TotalPrice also
I might be missing something obvious so apologies if there is a good reason why I am struggling with this or I cannot do it.
I think you might want to look up on "Order Calculation State" https://vendr.net/docs/core/2.1.0/umbraco-v9/key-concepts/order-calculation-state/ as during an order calculation the order values are not updated. It's only once the calculation is complete that the values are copied over. During a calculation there is a calculation context where everything is stored until then.
Thanks for the quick reply and sorry for the delay in getting back to you.
Thanks for your suggestion. I went back and checked the 'context' argument and the 'OrderCalculation' property is currently null. I assume this is because we have no other custom calculators currently implemented other than this one?
From reading the docs in the link you provided, you suggest using the 'Order' property only when the 'OrderCalculation' is null. As this is what I have already attempted in my original post, is there anything else you can suggest?
To be clear, we only need to amend the display of the price of the shipping options. The order shipping cost is correctly calculated to take into account the automatic discount after this step, however we want to make this clearer to the user.
I'd be happy to explain further/better if that will help.
Vendr checkout - update shipping method prices to reflect discounts
Hi,
I am using Vendr 2.1.2 and Vendr.Checkout 2.1.0. I'm trying to use a ShippingCalculator to update the price displayed for shipping methods on the shipping method selection stage.
This is so that users can see the actual shipping method cost before they select which one they want.
My idea is to calculate all price adjustments to shipping and deduct that from the original shipping method price (for the current currency) for each shipping method and display the adjusted price to the user.
We have an automatic discount in place for orders over a certain value. I can see that discount is being applied to the order at the shipping selection stage, but cannot see the adjustment value(s).
The below screenshot shows that the Order has a zero value for the 'Adjustment' properties on ShippingInfo.TotalPrice. The same issue applies to each of the 'Price' objects in the 'Adjustments' property of TotalPrice also
I might be missing something obvious so apologies if there is a good reason why I am struggling with this or I cannot do it.
Appreciate any advice you can offer.
Thanks in advance
Hi Christopher,
I think you might want to look up on "Order Calculation State" https://vendr.net/docs/core/2.1.0/umbraco-v9/key-concepts/order-calculation-state/ as during an order calculation the order values are not updated. It's only once the calculation is complete that the values are copied over. During a calculation there is a calculation context where everything is stored until then.
Hope this helps
Matt
Hi Matt,
Thanks for the quick reply and sorry for the delay in getting back to you.
Thanks for your suggestion. I went back and checked the 'context' argument and the 'OrderCalculation' property is currently null. I assume this is because we have no other custom calculators currently implemented other than this one?
From reading the docs in the link you provided, you suggest using the 'Order' property only when the 'OrderCalculation' is null. As this is what I have already attempted in my original post, is there anything else you can suggest?
To be clear, we only need to amend the display of the price of the shipping options. The order shipping cost is correctly calculated to take into account the automatic discount after this step, however we want to make this clearer to the user.
I'd be happy to explain further/better if that will help.
Thanks Chris
is working on a reply...