Anyone have advice about editing the checkout session through the API to add a shipping fee/duty?
My plan is to use checkout.liquid to get all the line items on an order, then send an AJAX post to my private app, process the data in some way, then return a number like "28.29" and this will be an added cost to the customer that I can render and display using liquid.checkout.
I feel comfortable and familiar with every aspect of this ASIDE from the part where I'm changing the total that the customer is paying. What endpoint do I use? I know I can use this (https://shopify.dev/docs/themes/ajax-api) to edit the quantity of an item that exists in Shopify, but I want something more abstract- I want to add an arbitrary charge to the order not connected to a Shopify product.
If anyone has input, I'd love to hear!
Hey Alexandros, adding amounts to the checkout total is pretty difficult. You'll want to incorporate the additional charge into a shipping rate or payment method. Worst case scenario, look at adding a product to every order representing your extra fee, discounted by default, and undiscount it to the price you want as needed. You can't change the price of an item to more than it originally was, for user experience reasons.