Developer forum

Forum » Ecommerce - Standard features » Shipping fee estimate

Shipping fee estimate

Adrian Ursu
Reply

Hello Guys,

I need to display a shipping fee estimate in the product details page.

The shipping cost is based on weight.

I see that the shipping information can only be accessedin the cart. Is there any way I can estimate the shipping based on weight?

Something like GetShippingFeeByWeight(weight) ?

Thanks,

Adrian


Replies

 
Nicolai Høeg Pedersen
Reply

Hi Adrian

Shipping is calculated on the cart - if you have i.e. 2 or more items in there, and that is why it is related to the cart.

The actual calculation is handled in Dynamicweb.eCommerce.Orders.ShippingCalculator, but it is internal, so you cannot access it. But it also takes in an order as the argument because it needs both a user context, currency, orderlines, vat groups, delivery country etc. to calculate.

But you have Dynamicweb.eCommerce.Orders.Shipping.getShippingmethods() that returns all the shippings. Based on that collection you should be able to find the estimate.

BR Nicolai

 
Adrian Ursu
Reply

Hi Nicolai,

I undestrand that completely. I was thinking of accessing the Default fee and the cost estimate based on product weight.

I will probably try to mimic it on the product page since it a very liniar shipping fee calculation based on weight, if I won't be able to access the shipping method.

Thanks a lot,
Adrian

 

You must be logged in to post in the forum