Don't miss out Virtual Happy Hour today (April 26).

Try our conversational search powered by Generative AI!

Set shipping cost to 0 and override selected method price

Vote:
 

Hi!

Is there any way to set the shipping cost on an order? I the user clicks a checkbox all shippingmethods should get the price 0 and when validating the order it should stay 0 and not be calculated depending on selected method default price. Is there anyway to do that?

Thanks!

/Kristoffer

#224245
Jun 15, 2020 8:43
Siddharth Gupta - Jun 18, 2020 3:16
I would add a metafield on the cart that is flagged if the checkbox is checked. And then implement a custom shipping gateway to calculate the shipping cost, and in there you could simply check if the meta field is flagged then set the shipping cost to zero. For the custom shipping gateway you can implement the IShippingPlugin, it has a GetRate method within which you can add your custom shipping logic.
Vote:
 

Anyone?

/Kristoffer

#224348
Jun 17, 2020 8:27
Vote:
 

I would go with Siddharth's suggestion: implement IShippingPlugin with GetRate method to handle logic. 

#224382
Jun 18, 2020 5:51
Vote:
 

Thanks! I would have hoped to not have to do that since we are using a built provider but I guess that is the best way of doing it. I will fix it, thanks!

/Kristoffer

#224383
Jun 18, 2020 7:27
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.