Thanks so much for the reply @oliversinz ! I’ll try to give you more context around what I’m trying to do:
Context: I’m currently plugging a custom payment provider into Shopify, the main flow is working great, user can select as a payment option, gets redirected to our app, and finishes the payment successfully by connecting into their bank account.
User is then redirected to the Thank You/Order Status page, where I have a JS code that changes the subtotal to take into account the discount when the payment is done through our provider. Here’s an example:
“original” subtotal (without the discount yet): $ 10
provider discount: $ 1
subtotal (after discount): $ 10 - $ 1 = $ 9
We could successfully edit the HTML in the Thank You/Order Status page to show the subtotal with discount ($ 9), the problem is that the email sent to the customer is not applying the discount yet, so, this is what I’m trying to do.
I think the way to do it, is by persisting the provider_discount (100, which represents $1 in cents) and subtotal_after_discount (900, which represents $9 in cents) in the order, then render it in the email sent to the customer after completing an order. So, how can I do that?
There’s a important thing to keep in mind is that this can only be persisted after payment has been done through our provider, since we don’t want show it in the email sent to the client after completing a purchase when using different payment providers.
Here’s a breakdown of the most relevant attempts, and why they haven’t worked so far:
- Cart attributes: I couldn’t edit the cart attributes after completing the payment (in the Thank You/Order Status page), I tried by making a POST to /cart/update.js but it updates a new cart that is created after the order has been paid, not for the order the user is seeing in the Thank You/Order Status page;
- I tried adding fields in the checkout page, but that didn’t work. I think that is the Custom checkout attributes you mentioned that only work on Plus Shopify stores;
Am I missing something or doing something wrong? Is there a solution for Non-Shopify Plus stores do that?
Thank you!