For discussing the development and integration of subscription-enabled shops using Shopify's Subscription APIs.
Hello everyone!
I want to ask about the docs about implement deferred purchase options (Pre-Order). It seems that the docs for that don't provide enough information. This is the docs: https://shopify.dev/apps/purchase-options/deferred/modeling#building-deferred-purchase-options-in-yo...
I have followed all the steps, however I am still struggling with how to implement deferred purchase options (Pre-Order) in my app. I have used AJAX Cart API to add item with selling_plan to Cart but the API request returns the line_items without the selling plan attribute. It is supposed to return the line_items with the selling plan attributes.
When I proceed to checkout, it still charges the total amount, not the checkoutCharge that set in billingPolicy.
Below is my Cart AJAX API code I use to add the product with selling_plan to Cart
fetch(window.Shopify.routes.root + "cart/add.js", { method: "POST", body: JSON.stringify({ items: [ { id: 43887580578069, quantity: 1, selling_plan: 688132129045, }, ], }), headers: { "Content-type": "application/json; charset=UTF-8", }, }) .then((response) => response.json()) .then((json) => console.log(json)) .catch((err) => { console.log("err: ", err); });
Also, I have "Only show this product with these purchase options" tick true on a product, but when I add that product to Cart it still display the default payment method with full charge instead of the checkoutCharge in billingPolicy of Selling Plan
This is the documentation link I followed which has the correct response:
https://shopify.dev/api/ajax/reference/cart
I would be greatly appreciated if someone can help me with this.
Thanks
Hi @John269!
Just to confirm, for this deferred purchase option, have you followed https://shopify.dev/apps/purchase-options/deferred/deferred-purchase-options and set the selling plan up with the proper policies for pre-orders?
It may also be beneficial to ask this question in Shopify APIs and Technology to get more context around Cart API.
To learn more visit the Shopify Help Center or the Community Blog.
Thanks for replying @NPeneycad !
To confirm, yes I have followed all the steps of the link you gave before writing this post. I also checked the Products by using GraphQL Product Query, and it shown the Selling Plan attributes.
Since you suggested, I will also try ask in Shopify APIs and Technology to see if anyone else have any advices.
Maybe your store is not eligible for the subscription. If you use a subscription in your store then must enable Shopify Payment. But please use test mode.
For more details you can check below screenshot.
Thanks