JS Buy SDK
The JavaScript (JS) Buy SDK is a lightweight library that lets you add commerce to any website. It's based on Shopify'sStorefront APIand provides the ability to retrieve products and collections from your store, add products to a cart, and check out.
Requirements
Anchor link to section titled "Requirements"- You've created adevelopment storeor have a production store.
- You've createdproductsorcollectionsin your store.
- You have experience writing JavaScript. The JS Buy SDK tool is intended for use by developers who are experienced with JavaScript.
- You have a website and want to add commerce functionality to it.
Step 1: Generate an access token
Anchor link to section titled "Step 1: Generate an access token"To generate an access token, you create a custom app eitherusing OAuthorin the Shopify admin.
当你安装生成访问令牌custom app. You include the access token with any requests made from your app to Shopify.
Step 2: Make your products and collections available
Anchor link to section titled "Step 2: Make your products and collections available"After you've generated an access token, you need to make products and collections available to your custom app to access them from your app. After the products and collections are available, you can retrieve them using their respective IDs.
Make a product available
Anchor link to section titled "Make a product available"- From your Shopify admin, go toProducts.
- From theProductspage, click the product you want to make available.
- Next toSALES CHANNELS AND APPSclickManage.
- In theSales channels and appsdialog box, select the box next to the name of your custom app.
Make a collection available
Anchor link to section titled "Make a collection available"- From your Shopify admin, go toProductsand clickCollections.
- From theCollectionspage, click the collection you want to make available.
- Next toSALES CHANNELS AND APPSclickManage.
- In theSales channels and appsdialog box, select the box next to the name of your custom app.
Step 3: Access the JS Buy SDK
Anchor link to section titled "Step 3: Access the JS Buy SDK"The JS Buy SDK can render data on the client side or server. Using the JS Buy SDK, you can do the following:
- Fetch information about a single product or a collection of products
- Create a shopping cart
- Allow customers to select options and quantities
- Generate a checkout URL for a single product or an entire cart
Where to get help
Anchor link to section titled "Where to get help"This SDK isn't supported by Shopify support, but there are other places where you can get help.
You can open an issue in the GitHub repository.
Visit our forums to connect with the community and learn more about the Shopify API and app development.
Find a Shopify Partner for hire in our ecosystem of talented development agencies.