Associating carts with orders with `order.cart_token` deprecation

Hello,

The order.cartToken on both the REST and GraphQL admin APIs is marked for deprecation, however our apps depends on this to associate a checkout session with an order.

I’ve already opened a past topic about this in the old forums, but new partners haven’t been able to add to the thread. Seems like the old forums are transitioning to read-only.

Here’s the original topic

Summary

App Developers rely on the order.cartToken to associate pre-checkout or during checkout actions that customers make against orders after checkout.

Without this link, every single app will need to generate their own unique ID token of sorts and need to stuff it is a metafield, cart attribute or some other key-value store that’s available pre-checkout that carries over to the post-checkout order object.

We please ask that Shopify re-consider deprecating this crucial order.cartToken attribute, because it currently is the only standard for a unique identifier that tracks the checkout into a final order object.

2 Likes

+1 to this. Our app also fundamentally relies on the existence of a link between Checkout session and subsequent Order.

Would appreciate some guidance from Shopify on what could be done as relying on Metafields is a messy solution to something that was not a problem pre deprecation announcement.

This is a big deal for us too. One workaround I have been doing is searching through all orders with cart_token because thankfully that is still not deprecated but it is a very expensive query for stores with high order volume

const cartTokens = ['a', 'very', 'big', 'list', 'of', 'tokens'];
let hasNextPage = true;
while(hasNextPage) {
  const query = `{
      orders(first: 100, after: ${cursor ? `"${cursor}"` : "null"}, query:"${cartTokens
        .map((cartToken) => `cart_token:${cartToken}`)
        .join(" OR ")}") {
        pageInfo {
          hasNextPage
          endCursor
        }
        edges {
          node {
            createdAt
            totalPriceSet {
              shopMoney {
                amount
              }
            }
          }
        }
      }
    }`;
  const response = await api(query);
  hasNextPage = response.data.orders.pageInfo.hasNextPage;
}
1 Like

Thanks for sharing your workaround @Zarma_Charu , yes that is expensive computationally and for performance. Also, on high order volumes there’s a risk of the order being outside of the pagination limit.

Not trying to knock your method at all, just want to make it clear to the Shopify team of how this change is a huge detriment to apps that have any before checkout action that needs to be attributed to a specific order.

Can anyone at Shopify please provide a recommended path for us to move forward with the order.cartToken deprecation?

Are you expecting developers to somehow add metafields to the cart that will be transferred to the order? If so that’s only available to Plus stores using Checkout UI Extensions and that’s out of reach for most of merchants.

As far as I’m aware, the only metafield type system available is to stuff cart attributes which display in the Shopify Order Admin panel and are editable by end staff, not ideal for tracking with UUIDs. Every single app that performs a pre-checkout action will then need to leave their own bespoke UUID on every order.

I just want to make it clear how this deprecation is realistically affecting app developers. But I only have our side of the story because this thread hasn’t been responded to in either the Github, the merchant community forum or here. I would love to understand the logic behind this change and how we can adapt to it for a seamless transition for merchants.

1 Like

Appreciate your feedback and your challenges here Dylan - I’ve connected with the Orders product team to understand what their recommendation is here.

1 Like

Just wanted to update here - our team are aware of the gap here and will be addressing it. They’ve recommended that until there is a robust alternative in GraphQL you should continue using order.cartToken in the REST API.

3 Likes

You’re a rockstar @Liam-Shopify thank you so much for representing us! I’m relieved that we’re finally able to get our message across.

Looking forward to seeing what the solution is, and I’ll definitely help spread the word once there’s an official way of pre-checkout action/resource <> post-checkout order associations possible again.

+1 here :slightly_smiling_face:
We need this to support our post purchase upsell functionality

1 Like

Hey @Liam-Shopify - Does that mean we can continue using the current api (until there’s a standard robust solution with graphql) without worrying about the April 1 deprecation deadline? :slightly_smiling_face:

The April 1 deprecation deadline is only for the Products/Variants REST API endpoints - and does not affect orders.

2 Likes

Thanks a lot Liam!! Appreciate the support

Thank goodness this community was created. Liam’s quick responses to any inquiries make this a whole new chapter for developers, where communication truly flows smoothly :smiley:

1 Like

So sorry if this is redundant. Just confirming because my team is panicking about the deprecation warning on the partners dashbaord :slightly_smiling_face:

I don’t see @Dylan mentioning the abandoned checkout api in the thread. We’re using Abandoned Checkout API to get checkout data for our post purchase upsell functionality and this is due for deprecation here. The current thread is emphasising specifically the “cartToken” field deprecation and not the abandoned checkout api itself.

Just need to know that this api is not going to get deprecated and not just the field. Couldn’t find a thread discussing specifically about the post purchase upsell issue except for this one on slack that Dylan had responded to

I see @Liam-Shopify’s message stating that the deprecation deadline won’t affect orders. However, the one we are using a checkout api not orders api :sweat_smile:
We don’t wanna get delisted yea. Thanks a lot to you guys for all the support again!

I’ve confirmed with the product team that you should continue using order.cartToken on the REST API.

1 Like

Hi @rafathsweb

This topic is specifically about the order.cartToken field on the Admin Order GraphQL / REST APIs.

The deprecation you’re referencing belongs to a different API altogether. To help keep this topic focused, it might be best to open a separate topic about the Abandoned Checkout API concern you have.

1 Like

@Liam-Shopify Encountered this problem and was very happy to locate this thread! Is the workaround proposed by the product team the same for new applications? I’m noting “Starting April 1, 2025, all new public apps must be built exclusively with the GraphQL Admin API.” on the REST API docs page. Could you please confirm whether a new public app built to use the REST API to access order.cardToken would be approved regardless of the notice?

Can we get a confirmation if order.cartToken in webhooks will not be deprecated?