Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
I'm writing a function that will put an order to Shopify through the API. I don't know how the cart-token and checkout-token are generated on the Shopify side when an order is created. Does anyone know how I can set those to be generated by Shopify when the order is put?
Can you provide a few more details on what you're trying to do?
Creating orders through our Order API won't require you to worry about either of these tokens as these are generated on Shopify's side for each action (cart creation and checkout creation, neither of which happen when creating only an order).
Ben | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
As you mentioned cart_token is generated on Shopify side. I just want to know that if this token remains same all the time when one add to cart from a specific store or changes after some time. Is there any expiry for this cart_token?
I'm trying to use the API for the company I work for, which can create an order, then push that order to the Shopify API.
Great, so you don't need to worry about those tokens 🙂 You can create the Orders directly through the Order API
Ben | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
If you use Order API, you will have to:
So you can't just simply create Orders without doing a BUNCH more work on other (unrelated) things. The checkout API neatly calculates taxes and appropriate shipping rates for you.
If these were supported in the Order API, it would be lovely though. This is by far my biggest pain point in the Order API.