I assume you mean when you are doing a checkout ? When you are using the Shopping Cart there is no Order The Order is not created until the Shoping Cart process is Completed Until then values are the values selected in the Checkout are stored as Generic Attributes and in the Addesses in the WorkContext
I am trying to break this down into separate components to try to take each section step-by-step. I was able to get through the PdfServices.cs and the MessageTokenProvider.cs and properly display the Extra Shipping Box when the Order is being shipped out of State (Florida) and weigh a certain amount. Now I am working on the OrderTotalCalculationService.cs and I think I can add the extra item to the Total if I use the UpdateOrderTotals() Method.
I think I can get each Item quantity to get the weight with the following code:
var orderItemQuant = 0; foreach (var item in restoredCart) { orderItemQuant += item.Quantity; }
But, I still need to get the Shipping Address State (Florida) to determine the Box size and additional price. How do I get the Shipping Address from that Method?
Thank you for your advice. I was able to get the calculations working as needed, but, I am stuck on the Admin Section. Please observe the New Styrofoam Box entry:
How do I get my generated results from the Cart/Checkout Page to reflect into the Admin Section and PDF Invoice to the Client?
I'd recommend that you use a Checkout Attribute. Visually, it would appear above the subtotal area rather than in it, but it's built-in and you would not have to deal with your custom 'line item' anywhere/everywhere, but rather just suppress the checkout attribute prompt from appearing in the shopping cart page.
In my Case, I have a complex requirement, such as: 1. I have a requirement to add a Shipping Box cooler when shipping out of the Warehouse State. There is a different charge for different sizes, based on the weight of the Cart. I do not charge or need the box if the user picks-up the package I do not need the Cooler if the Client is in the same State as my warehouse.
These are the conditions that I had to consider and applied to the cart. Is this possible in a checkout attribute and it will appear everywhere, including the invoice to the Client?
First, you should create a text box type checkout attribute in the admin, then go to the cart and enter some $ amount in the checkout attribute text box and continue checkout / confirm the order. Then verify in all the places you would expect it to appear (admin order, PDF invoice, etc.). If it does not appear where/how you expect, the it would defeat the purpose of the recommendation.
Excellent News... I was able to repair or code all the relevant areas, except one (1). Where do I adjust the pricing on the List (Admin Section)? My Styrofoam Cooler price is not getting added to the final Total on this list.