However, when an order is partially paid and the merchant sends an email to the customer, the cart attributes disappear from the checkout. While attributes remain visible in the admin order notes, they are no longer present in the customer-facing checkout and in Shopify functions:
Hey @David_Arbias - just confirming my understanding here. The initial cart is successfully converted into a order, but the order is just marked as partially paid and the attributes appear correctly on the created order?
If so, that is expected behaviour, carts usually are deleted after they’re converted into an order. Just out of curiosity, are you still able to access the original carts after they’ve been converted into a partially paid order? Essentially, if a partially paid order is created from a cart, we do consider that cart’s journey as completed. So, if a customer is returning back to the checkout to pay the rest of their invoice, this is technically considered a “new” checkout, even if it originated from an old cart.
Hope this helps/makes sense - let me know if I can clarify anything or if I’m misunderstanding here, happy to help!
It is possible to access a cart in shopify functions after the order has been partially paid, but all of the original cart and line item attributes get removed.
This greatly reduces what you can do in for example payment functions, because you can’t access information about the order, since shopify functions are intended to actually run during the cart phase.
We’re trying to solve this using customer metafields, but this is not a good solution since customers may have more than one partially paid order.
Unfortunately this is expected behaviour based on how the partial payment flow works. When the original cart converts into an order (even a partially paid one), that cart’s lifecycle is considered complete. When the customer comes back to pay the rest, they’re entering a fresh checkout context rather than continuing the original cart/checkout session, which is why the attributes aren’t there for your payment function to read there.
Shopify Functions are really designed to operate during that initial phase, so they don’t have an easy way to pull in data from an already-created order. It’s definitely a limitation for use cases like yours.
The workarounds aren’t ideal for sure, but customer metafields are a decent idea though, and might work depending on your setup.
Before I dig into the specifics of how we can structure that though, just a couple quick questions:
How common is it for a single customer to have multiple partially paid orders at once? If it’s rare or basically never happens, the implementation is pretty straightforward – just store the attributes directly on the customer metafield and clear them when the order is fully paid. If it’s common though, we’d need to key the data by order ID, and the tricky part is that the payment function during return-to-pay doesn’t really have order context to do that lookup which you mentioned earlier
What is your payment function actually trying to do with these attributes? Understanding the end goal might help us figure out if there’s a different approach that sidesteps this limitation entirely.
Hope to hear from you soon, happy to look into this further.
I’ve spoke with the merchant facing this issue and it seems he’s ok with customer tags since it’s really rare that a customer will have more than one partially paid order at the same time.
I’ve asked permission to share more details, but unfortunately they denied it
Glad the customer tags approach will work for this merchant’s use case.
I’ll make sure this feedback gets logged - the fact that original cart info doesn’t carry over when a customer returns to finish paying is worth having on our radar.
Let me know if anything else comes up - happy to help!