Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Shopify Cart Manipulation

Solved

Shopify Cart Manipulation

chris-heady
Visitor
3 0 0

Greetings, 

We have an interesting issue that we are facing with the AJAX Cart API. 

We have several systems working together and we would like shopify to play the main Cart and point of transaction. 

  • Website (Shopify)
  • Mobile App (Shopify SDK)
  • Waitlist (Custom Middleware application)

Ideally we are attempting to figure out a way to use the Shopify API to programmatically manage the users cart so they can checkout, vs having to build our own cart service. 

We have a waitlist service for a product that is out of stock, once the product becomes available we want to programmatically add to a users cart and send them a notice that they can checkout. On the flip side, we want to also remove an item from the cart if their window to purchase expires. 

However we are having issues keeping the cart in sync with the user, so this leads us to believe we need build our own cart management service and bypass Shopify's.

Any thoughts, greatly appreciate the assistance in advance. 

--Chris-Heady 

Accepted Solution (1)
PaulNewton
Shopify Partner
7536 666 1595

This is an accepted solution.


@chris-heady wrote:

The only drawback to this is, if a user has items in their cart on the website, they will not be included. There really is no mechanism to keep the carts in sync and still manage inventory with the waitlist and checkout timer. 

That's right there's no native way to sync carts , aka persistent cart, even for signed in accounts.

The cart however is in json format  shop.com/cart.json so just fetch and push, use cart attributes to store sync state timing information if need be.

persistent carts are a hairy business, goodluck nntr.

Contact paull.newton+shopifyforum@gmail.com for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org


View solution in original post

Replies 5 (5)

PaulNewton
Shopify Partner
7536 666 1595

Hottake is you would be using cart permalinks, or generating draft orders.

Contact paull.newton+shopifyforum@gmail.com for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org


chris-heady
Visitor
3 0 0

Thanks @PaulNewton Not sure what you mean, are you asking if we are using permalinks or draft orders?

PaulNewton
Shopify Partner
7536 666 1595

Not asking if your using those feature, but stating you may have to use those features to get the outcome your looking for from the info you've provided.

Can't edit posts after 3 hours or i'd fix the initial to clarify /sigh.

 

Contact paull.newton+shopifyforum@gmail.com for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org


chris-heady
Visitor
3 0 0

Thanks @PaulNewton , Appreciate you response, we are looking into creating a set of middleware endpoints that can manage the cart, waitlist and timing of the experience, then using a permalink to checkout via Shopify. 

The only drawback to this is, if a user has items in their cart on the website, they will not be included. There really is no mechanism to keep the carts in sync and still manage inventory with the waitlist and checkout timer. 

Thanks for your advice. 

PaulNewton
Shopify Partner
7536 666 1595

This is an accepted solution.


@chris-heady wrote:

The only drawback to this is, if a user has items in their cart on the website, they will not be included. There really is no mechanism to keep the carts in sync and still manage inventory with the waitlist and checkout timer. 

That's right there's no native way to sync carts , aka persistent cart, even for signed in accounts.

The cart however is in json format  shop.com/cart.json so just fetch and push, use cart attributes to store sync state timing information if need be.

persistent carts are a hairy business, goodluck nntr.

Contact paull.newton+shopifyforum@gmail.com for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org