I am in the process of building a custom checkout widget. I am running into two large issues. As part of the build we are integrating the checkout widget with Avalara for calculating the tax.
The main problem that I am having is that when I add the shipping and tax amounts to the order the Order Total is not updating. With the tax the problem is even worse because the amount is not being saved to the database.
Code snippet that encapsulates what I am doing:
cart.ShippingServiceCode = shippingMethod.ServiceCode;
cart.ShippingServiceName = shippingMethod.ServiceName;
cart.ShippingTotal = shippingMethod.ServicePrice.GetValueOrDefault(0);
cart.Tax = 30; <--tax hard coded in this example. amount really comes from avalara
cart = CartHelper.GetCartOrder(this.OrdersManager, this.GetShoppingCartId());
LiteralSubTotal.Text = order.SubTotalDisplay.ToString("C");
LiteralOrderTotal.Text = order.Total.ToString("C");
LiteralOrderDiscount.Text = order.Discounts.Sum(p => p.DiscountAmount).ToString("C");
LiteralOrderShipping.Text = order.ShippingTotal.ToString("C");
LiteralOrderTax.Text = order.Tax.ToString("C");
The problem is that the order total does not include the shipping and the tax. Worse is the fact that the tax amount is not saved to the database.
I hope I am missing something obvious.