Could you please advise me the
best/easiest way to multiply the shipping cost (set by country and region) by
the total quantity of items in the order using a custom shipping calculator in v2.1?
It was actually the properties required to calculate the shipping by the total quantity I was looking for, below is what I have currently used (maybe there is a better way?)?
Shipping cost multiplied by total quantity
Hi There,
Could you please advise me the best/easiest way to multiply the shipping cost (set by country and region) by the total quantity of items in the order using a custom shipping calculator in v2.1?
Thanks,
Jeavon
Hi Jeavon
See this post about a custom shipping calculator:
http://our.umbraco.org/projects/website-utilities/tea-commerce/tea-commerce-support/40587-Shipping-per-product
Kind regards
Anders
Hi Anders,
It was actually the properties required to calculate the shipping by the total quantity I was looking for, below is what I have currently used (maybe there is a better way?)?
[SuppressDependencyAttribute( "TeaCommerce.Api.PriceCalculators.IShippingCalculator", "TeaCommerce.Api" )] public class CustomShippingCalculator : ShippingCalculator { public CustomShippingCalculator(IVatGroupService vatGroupService, ICurrencyService currencyService): base( vatGroupService, currencyService ) { } protected override decimal CalculatePrice(ShippingMethod shippingMethod, Currency currency, Order order) { long countryId = order.ShipmentInformation.CountryId ?? default(long); long? countryRegionId = order.ShipmentInformation.CountryRegionId; decimal currentShippingPrice = shippingMethod.GetOriginalPrice(currency.Id, countryId, countryRegionId); decimal totalQuantity = order.OrderLines.Sum(x => x.Quantity); return currentShippingPrice * totalQuantity; } }
Thanks,
Jeavon
I would properly use:
Thats it :)
Kind regards
Anders
Awesome! When will the .NET API new documentation be ready?
Dont have a specific date - we will work on it and release each page about the .NET part when its ready
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.