Ad

Can You Use An External Cart In Shopify Thats Hosted On An External Website?

- 1 answer

I am creating a website that is not within Shopify where a customer can select items and then make purchases. I want the customer to use a cart that I'd create vs a redirect/open new window when they want to make a purchase. I do have a Shopify Store that has the products that contain the variants and their prices.

I am using node.js and express and the shopify-node-api (https://www.npmjs.com/package/shopify-node-api) module.

I would like to know if this use case is possible:

  1. Customer goes to my site http://example.com (external to shopify)
  2. Customer makes their selections of product by clicking 'add to cart' on http://example.com
  3. The cart that I create on http://example.com gets updated with the line items and prices
  4. Customer clicks 'checkout' button on http://example.com. There is ajax communication between http://example.com and my shopify store.
  5. My shopify store handles the purchasing/credit card info in the background and once successful or errors out, sends a response back to http://example.com to notify customer of success or errors.

I am attempting to use Shopify as a service to handle the credit card transactions without the need to redirect them to the Shopify store. I would like to user their AJAX API to communicate with http://example.com.

Based on the documentation, it is unclear if the http://example.com needs to be hosted within Shopify.

So far, I am only able to make get requests successfully. I am running into difficulties POSTING to Shopify.

I have followed both the Private App and Public App Guides.

I currently am using a Public App and have recently obtained a permanent token. Still unable to Post to the Shopify Cart. Does anyone have any success doing such? Or can offer an example or documentation on how to do the above?

Ad

Answer

I do not think that this can be done via ajax. The way that I figured out is to build a local object from the customer choices and then parse the object to build the url that will post to shopify. Then show the shopify cart within an iframe.

Ad
source: stackoverflow.com
Ad