In my Online Store, when my customer clicks the “buy now” button, a checkout should be created with some product variant line items. I have tried some APIs, but all of them do not work very well.
Background / Context
Before starting, some information should be kept in mind:
-
I am only talking about Online Store, the default channel.
-
the store installed an custom app which is created in Shopify Admin. the custom app is not created by Shopify Partner.
What I tried or I am going to try
Solution 1 : Cart permalink
The trouble is : line item properites is not supported.
Solution 2: Storefront API CheckoutCreate
There are some troubles:
- Abandoned Checkout / Order triggered by the checkout would be marked as “From xxx app” instead of “From Online Store”
- Abandoned Checkout would not send emails because of “From xxx app”
- Analytics treats my custom app and Online Store as two channels.
- It requires that sales channels of the products should including my custom app. This would create an additional mental burden for operators.
I just use my custom app to enhance the Online Store, if my custom app is treated as Online Store channel, those troubles would gone and Solution 2 would work well.
Solution 3: AJAX API about cart ?
I am going to try. But I am not sure this is a good solution, because :
- It would modify to override items the existing cart of the customer.
- It seems that the api doc does not officially tell how to get the checkout page url based on the cart.
So, what is the right way to implement the custom checkoutCreate function to enhance Online Store ?