You can only set a single payment method on an order currently (we are reviewing the possibility of supporting multiple shipments, but I'm not sure that's your issue here)
You can of course define whatever shipping methods you want and allow one to be selected, but yea, an order can only have one shipping method which is whatever that selection is.
That's what I thought, but just wanted to be sure.
Is there a way to do some custom calcultion on the orders total shipping cost?
I have a shippingcost calculator already, but that one is also used to get the price for the shipping method which can be chosen in the checkout. And I Couldn't find out when the calculator is processing which one.
Because of dynamic prices, I cannot create a Shipping method for all 3 methods combined. So I was thinking to add the ShippingMethod keys in a custom order property, and use that to show in the front-end and do the correct total shipping price calculation.
I thought overriding the OrderCalculator, but that method isn't overridable, which make me think I need to add an extra calculator in the CalculateOrderPipeline? Is that the correct way?
Added a PipelineTask which adds adjustments to the shippingcost.
public class CalculateCorrectShippingCostTask : PipelineTaskWithTypedArgsBase<OrderCalculationPipelineArgs, OrderCalculation> {
public override PipelineResult<OrderCalculation> Execute(OrderCalculationPipelineArgs args)
{
var price = new Price(100, 0, args.Order.CurrencyId);
var adjustment = new ShippingCostAdjustment("Express", "MD-001", price);
args.Calculation.ShippingTotalPrice.Adjustments.Clear();
args.Calculation.ShippingTotalPrice.Adjustments.Add(adjustment);
return Ok(args.Calculation);
}
}
This is just for testing purposes only, but the extra 100 euro's is added the shippinginfo in the order object. And also calculated correctly.
Add multiple Shipping Methods to an order
Hi Matt,
I was wondering if it would be possible to add multiple Shipping Methods to an order. I am using this method, but that only allows one:
In my case there are multiple types of methods:
eg:
Thanks!
Puck
Hi Puck,
You can only set a single payment method on an order currently (we are reviewing the possibility of supporting multiple shipments, but I'm not sure that's your issue here)
You can of course define whatever shipping methods you want and allow one to be selected, but yea, an order can only have one shipping method which is whatever that selection is.
Hi Matt,
That's what I thought, but just wanted to be sure.
Is there a way to do some custom calcultion on the orders total shipping cost? I have a shippingcost calculator already, but that one is also used to get the price for the shipping method which can be chosen in the checkout. And I Couldn't find out when the calculator is processing which one.
Because of dynamic prices, I cannot create a Shipping method for all 3 methods combined. So I was thinking to add the ShippingMethod keys in a custom order property, and use that to show in the front-end and do the correct total shipping price calculation.
I thought overriding the OrderCalculator, but that method isn't overridable, which make me think I need to add an extra calculator in the CalculateOrderPipeline? Is that the correct way?
I think I got it working!
Added a PipelineTask which adds adjustments to the shippingcost.
This is just for testing purposes only, but the extra 100 euro's is added the shippinginfo in the order object. And also calculated correctly.
Nicely done, but you might also want to check the docs here on price adjustments https://vendr.net/docs/core/3.0.0/key-concepts/price-amount-adjustments/ for how you can set them up without needing to inject your own pipeline task.
Thanks! I will try that also :) Maybe that will be better in my case.
is working on a reply...