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.
We do FB Live sales and invoice people afterward. If there participants spend $20 or more they get free shipping.
So, often we will get people requesting to add some of our regularly priced items to their invoice.
It would be great if the customer could add products to their invoice. We get a lot of additional sales this way, but we're just having to manually add the products that the customer asks for. :(
To me, always having the ability to "add more products" to your cart or invoice is a no-brainer. I don't see why Shopify would have to rebuild how they do things. If they hit the cart button, then create a new token with the products from their invoice.
We've also tried just using the POS and emailing the cart to the customer, but there's not option for them to "keep shopping" and add more products to their purchase.
I completely agree with @Robbie3, seems like a no-brainer as we would all win by bridging the invoice/draft order back to the website and cart. I also thought the POS Email Cart was the workaround until I tested it and it just uses the same Draft Order process.
Is there an app that might give us this functionality?
Development wise this is tricky and any 'return to cart' functionality is workaround at best.
Plus stores could edit the checkout to have conditional flags to make a return to cart link either using the ajax endpoints or passing parameters to special template that then auto-adds the items to the cart.
Any app doing this would not just have to support the Draft API but run frontend code to fill a customers cart with items known to be in the draft order, or be a proxy app.
A big caveat keep in mind that line-items,discounts,etc created in a draft order may not be possible to represent on the front end.
By either the item not actually existing,out of stock,etc and non existent discount codes,etc.
Hi there @PaulNewton ,
Thanks for your reply.
I noticed you mentioned apps that use this approach should also ensure the cart is filled (and in line with the draft order).
This isn't always a hard thing to do. In fact in the typical use case for using draft order checkouts this is per definition the case. Let me clarify what I mean: a number of discount apps (ours included) use Draft Orders to create advanced, discounted checkouts. We also use the Checkout API to do the same. The process requires discount apps to check what's in the cart and then intercept the checkout to apply discounts and send customers to a checkout created using the aforementioned APIs. In this use case, there is a cart in context. It is true that the discounts in this cart do not match what the discounted checkout displays because the cart JS API does not support what those other APIs do support.
The solution is super simple: the app developer should be able to just show a link that brings the customer back to shop.myshopify.com/cart. If the app developer knows that the use case for which he is building the solution will have a cart in context then he should be able to set a flag that shows this link. Visitors will go back to the cart and can change the content of the cart.
The same goes for the missing "back to home page" link in these checkouts. The solution is just to allow app developers to set a flag to ensure clicking the logo (or any other link that Shopify decides should have this behavior) redirects to the home page.
Putting the responsibility with the app developer to let the API know whether a link to the cart or home page should be displayed seems like the right thing to do for me.
It looks like a 1/ simple extension of the API 2/ without impact for existing implementations if the defaults are not to show the links and 3/ great benefits for a sizeable group of merchants.
We have been asking for this for like 3 years, we lock out the add to cart option, and do exclusively quoting. But we really would like to have the ability for the recipient of the Drafts (we call it Quotes) to adjust qty of the items and maybe apply discount codes - then head to checkout. Why can't we have a simple Checkbox in Draft Order creation that lets us pick wether the items will be sent to a cart (which we would use all the time), or directly to checkout (good for fixed invoicing for those who might need it). Seems like such a simple concept.