I’m currently using the Shopify Ajax API, but have confirmed with Shopify that they have issues that randomly occur, with this API, that may cause the line item properties on items programmatically added to the Shopify cart to just disappear at some point during the checkout. We cannot replicate and have been trying for well over a year. We can only confirm that our line item properties exists when they are added to the cart and then at some point during the Shopify checkout process that Shopify is removing line item properties randomly on their side.
We’ve been using the Shopify Ajax API for years and can confirm that this behavior, where line item properties (not line items) on items just disappear, during the checkout process, after having successfully added to the cart is happening. Out of several hundred orders/day it happens less than a dozen times a day and there is no rhyme or reason to why this is happening. Again, Shopify support has confirmed this is an issue on their side.
Further, Shopify support has told me that because the issue happens so randomly, that they do not intend to commit any resources to the small dev team at Shopify that work on this the Ajax API to resolve it.
The suggestion I received is to poll the community here for a more current alternate API to the Ajax API for programmatically adding line items to the cart that have line item properties. That being said, below is my current flow for adding items, from a 3rd party site, using the Shopify Ajax API and an app proxy url. Please lmk if you have a suggestion for a replacement using a more current API then the Ajax API to do what I need. The most important point here, that I’ve put in bold, is that the line items have specific line item properties. So I’m not just adding line items to the cart.
Why line item properties are critical for my use case: These line item properties are used by back end systems that require specific data on the line items to be able to manufacture a given line item, such as a name or a link to programmatically created image the user designed for the line item.
Current flow using the Shopify Ajax API and an app proxy url:
-
Users come from a 3rd party (not Shopify) site, where they have tapped a button that POST’s data to a Shopify app proxy url on our Shopify store.
-
The proxy url loads our proxy app, which parses the POST data and then uses the Shopify Ajax API to first remove (Update endpoint /cart/update.js) any items coming from the 3rd party site that are no longer valid, then we (Add endpoint /cart/add.js) to add line items with their line item properties to the Shopify cart. We do not clear any items that were added on Shopify, just items with specific line item property flags coming from the 3rd party site.
Hope that makes sense. Any thoughts on alternatives to the Shopify Ajax API to accomplish our flow coming from a 3rd party site? Think Buy Now button, but on steroids.
E.g. can I use the Storefront API with an app proxy url to POST line items and their properties and create a cart using a customer’s session?