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
I'm implementing different shipping prices by weight based on this post.
I'm using Umbraco v6 & Tea Commerce v2 so things are done a little differently.
The bit I'm struggling with is the setting of the shipping price.
In the original post it's done like this:
order.ShippingFeeWithoutVAT = totalShippingPriceWithoutVAT;order.Save();
In TC v2 you can't set the order.ShipmentInformation.TotalPrice.Value directly because it is read only.
Instead I've created a new price object and assigned it.
Price newShippingTotalPrice = new Price(shippingPriceWithoutVAT, order.VatRate, TeaCommerceHelper.GetCurrency(order.StoreId, order.CurrencyId));order.ShipmentInformation.TotalPrice = newShippingTotalPrice;order.Save();
However the new shipping price does not get saved to the order.If I read the order back immediately using
TeaCommerceHelper.GetCurrentOrder(order.StoreId);
I can see it has not been saved.
What am I doing wrong?
Regards, Matt
Hi Matt
You need to make a shipping calculator. Every time the order is saved we recalculate the shipping, order lines etc. That is why your price isn't "saved" - TC overwrites it when saving.
See this:http://documentation.teacommerce.net/net-api/price-calculators/shipping-calculator/
Kind regardsAnders
Ah, OK.
I did see that documentation but resisted change. ;-)
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How to set the shipping price in v2?
I'm implementing different shipping prices by weight based on this post.
I'm using Umbraco v6 & Tea Commerce v2 so things are done a little differently.
The bit I'm struggling with is the setting of the shipping price.
In the original post it's done like this:
order.ShippingFeeWithoutVAT = totalShippingPriceWithoutVAT;
order.Save();
In TC v2 you can't set the order.ShipmentInformation.TotalPrice.Value directly because it is read only.
Instead I've created a new price object and assigned it.
However the new shipping price does not get saved to the order.
If I read the order back immediately using
I can see it has not been saved.
What am I doing wrong?
Regards, Matt
Hi Matt
You need to make a shipping calculator. Every time the order is saved we recalculate the shipping, order lines etc. That is why your price isn't "saved" - TC overwrites it when saving.
See this:
http://documentation.teacommerce.net/net-api/price-calculators/shipping-calculator/
Kind regards
Anders
Ah, OK.
I did see that documentation but resisted change. ;-)
Regards, Matt
is working on a reply...