Is there a way to modify the attributes of an order on its Thank you page ? We can add liquid and JS on this page but I didn't see any way of doing it, the AJAX API allows to edit the cart attributes, but it's not usable anymore once the order is placed.
In last resort I will probably create a GCP Cloud Function that will call the Admin API when I AJAX something to it, but I would like to use a more native Shopify way if there is one.
No. By the time you are on the Thankyou page the order has been created so you’d be left with API options.
Why can’t the attribute be added before checkout? Knowing a bit of context into why you need it could reveal other approaches.
This is an unusual demand but the circumstances are unusual as well. We're actually setting the cart attributes before the checkout, but we're using the Mondial Relay official app, which happens to dynamically set its own order attributes after it's placed (the customer has to chose the relay point on the Thank You page with their script). The only problem being that when they update the order's attributes, they erase all the previous attributes set, which is a terrible behavior. Their customer support say that it's because they can't afford to make one more API call to retrieve existing attributes because of their huge clients and the API rate limit, but I'm sure there would be many other ways for them not to break this system.
So I basically need a way to set back the attributes they remove after the client chose their relay point.
(Btw, is there a way to report this kind of practice to Shopify market place ? This behavior is obviously not mentioned in their documentation)