When creating a checkout via the Checkout API or the Draft Order API and direct the visitor to the invoice url / web url, how can we ensure the "cart" link (top left corner) and "return to cart" (bottom left) are displayed like on a normal checkout?
I cannot find any setting in either API that allows me to display this.
The Checkout API does contain a cart key property, however that property cannot be combined with a custom checkout. In other words, when you add line items and do some custom stuff (which is always going to be the case, otherwise why would you bother using the Checkout API) the cart key cannot be set. An error message indicates you need to do one or the either, suggesting that feeding in a cart key allows the checkout to copy the line items and settings from the cart.
Every single merchant that tests our app asks us why we remove that link.
If I had a penny for every time I try to explain the difference between a standard and DraftOrder checkout...
I imagine every app developer that uses the Draft Order API or Checkout API gets the same question.
How can we solve this and show the cart link?
I hope I understood correctly your point, please correct me if I'm wrong.
I think you're using the Draft API in a wrong way if you're trying to use it as part of a store customer's shopping experience.
The draft order concept is for creating an order by a merchant, and send it to the customer for payment.
It could have been great if that concept was expanded to allow having creative shopping experiences, but I think at least currently it's not case.
There are more things that I think should be solved in the Draft order concept - for example allowing customers to add discount codes, or at least allowing the merchant to choose one from a list when they create the draft.
I think that for custom shopping experiences you should use the storefront and checkout apis, and if you are trying to add unique discounts (as seems to be applied from your email address) then you should use Shopify scripts, or at least ask for that part of the system to be open to all merchants (on all plans).
Thanks for your reply.
While I agree that using the DraftOrder API for these purposes is probably against the original idea behind the API, there are quite a few public apps that are using this technique (at least five I am aware of, there are probably more) today.
You are right in saying that the Checkout API is a better fit. But that API also has disadvantages.
Regardless, it doesn't support this "return to cart" feature either. At least not for checkout with lines that were created custom.
In my opinion both APIs should support this. The Checkout API should definitely.
Additionally the Checkout API should allow the user to control if a discount field is displayed or not.
With these features in place app developers can create the checkout experience merchants want.
The cart link in the checkout only exists if there is a cart associated with the checkout (a cart_token). The only time a cart token exists is when the line items were added to the cart through the storefront, thus, checkouts created through the Draft Order API and the Checkout API do not have associated cart tokens.
I've heard this same request come up in the past by other developers, however it's incredibly unlikely that we will make the change you're hoping for, as it would require a large refactoring of Shopify. If a cart_token does not exist on a checkout, there is no cart to lead the customer to.
Thanks for the clarification @Busfox .
Almost all of our merchants think this is an important feature to have.
I would expect this feature to be available in the Checkout API (and preferably also the DraftOrder API).
I don't have any view on the complexity of the code base, but in its most simplistic form you need:
Doesn't look super complicated to me, but again, I don't know the code base you're working with.
|an hour ago|
|2 hours ago|
|2 hours ago|