Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi All,
How can I access the given price in the "Pricing" tab of a shipping method for use in my custom shipping service? In my case, I'd like to default to this price if a shipment has under a certain quantity, and make it free otherwise.
public Money CalculateShippingPrice(Shipment shipment) { int totalQuantity = 0; foreach (OrderLine orderline in shipment.OrderLines) { totalQuantity += orderline.Quantity; } decimal shippingPrice; if (totalQuantity < 4) { shippingPrice = 5.95m; } else { // free shipping shippingPrice = 0; } return new Money(shippingPrice, shipment.PurchaseOrder.BillingCurrency); }
Thanks in advance for any insight!
Ben
Hi ben,
I think you can use
shipment.ShippingMethod.ShippingMethodPrices
It's a collection of prices and you can distinquish them on price group (as per the pricing tab).
Hope that helps.
Regards
Morten
Thanks Morten! I'll give it a try!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Get Price from Pricing Tab in Custom Shipping Service
Hi All,
How can I access the given price in the "Pricing" tab of a shipping method for use in my custom shipping service? In my case, I'd like to default to this price if a shipment has under a certain quantity, and make it free otherwise.
Thanks in advance for any insight!
Ben
Hi ben,
I think you can use
It's a collection of prices and you can distinquish them on price group (as per the pricing tab).
Hope that helps.
Regards
Morten
Thanks Morten! I'll give it a try!
Ben
is working on a reply...