Is there any kind of cart ID that gets created in POS that can be accessed in App Bridge Cart Properties (or elsewhere) that will also then show up in a completed order object?
On the cart side, I see a common id that shows up for APP::CART::SET_PROPERTIES and APP::CART::UPDATE, for example 16c6f01a-051b-00a8-a594-295653d11647. However, I don't see this id show up anywhere in the order object afterward.
On the order side, I see token, checkout_token, checkout_id, but none of these match the id retrieved by App Bridge. Thank you.
Solved! Go to the solution
This is an accepted solution.
Hey @policenauts1 ,
One way to accomplish this is to use the ID that you discovered that is sent on all `Cart` group actions in App Bridge. This ID is set when you create a Cart object in App Bridge.
If you create a Cart object then use the `APP::CART::SET_PROPERTIES` with the cart's id property used as the value it will then be saved to the cart for use outside of App Bridge.
Once the checkout happens and an Order is created, you can retrieve the cart's id that created the order by accessing the `custom_attributes` field.
Set Properties Action
cart.dispatch(Cart.Action.SET_PROPERTIES, { data: { "ID": "3e2f37dd-069a-0b39-b3a8-a1ec955dec5d" // The cart id } });
Query
query { order(id: "gid://shopify/Order/1964279267384") { customAttributes { key value } } }
Result
{ "data": { "order": { "customAttributes": [ { "key": "ID", "value": "3e2f37dd-069a-0b39-b3a8-a1ec955dec5d" } ] } } }
User | Count |
---|---|
16 | |
12 | |
7 | |
5 | |
4 |