Get started with shopify-buy CDN
MIT licensed
Shopify Buy: library for custom, frictionless buying, enabling in-page product purchase.
Tags:- shopping
- cart
- shopify
Stable version
Copied!
How to start using shopify-buy CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with shopify-buy CDN - cdnhub.io</title>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src="https://cdn.cdnhub.io/shopify-buy/2.21.1/shopify-buy.umd.min.js"></script>
</head>
<body>
<button id="buy-button">Buy Now</button>
<script>
const shopify = {
storefrontAccessToken: 'your_storefront_access_token',
apiVersion: 2021_04,
shopName: 'your_shop_name'
};
const buyButton = document.getElementById('buy-button');
shopify.initCheckoutSession().then((checkoutSession) => {
buyButton.addEventListener('click', async () => {
const lineItems = [{
title: 'Product 1',
variantId: 'variant_id_1',
quantity: 1
}];
const session = await shopify.checkout.createSession({
checkoutSessionId: checkoutSession.id,
lineItems
});
window.location = session.url;
});
}).catch((error) => {
console.error(error);
});
</script>
</body>
</html>
All versions
0.1.6
0.1.7
0.2.1
0.2.2
0.2.3
0.2.4
0.3.0
0.3.2
0.3.3
0.3.4
0.4.0
0.4.1
0.4.2
0.5.0
0.5.1
0.5.4
0.6.0
0.6.1
0.6.2
0.7.0
0.7.1
1.0.0
1.0.0-alpha.1
1.0.0-alpha.10
1.0.0-alpha.11
1.0.0-alpha.12
1.0.0-alpha.2
1.0.0-alpha.3
1.0.0-alpha.4
1.0.0-alpha.5
1.0.0-alpha.6
1.0.0-alpha.7
1.0.0-alpha.8
1.0.0-alpha.9
1.0.0-beta.0
1.0.0-beta.1
1.0.0-beta.2
1.0.0-beta.3
1.0.0-beta.4
1.0.0-beta.5
1.0.1
1.0.2
1.1.0
1.10.0
1.11.0
1.2.0
1.3.0
1.3.1
1.4.0
1.5.0
1.6.0
1.7.0
1.8.0
1.9.0
1.9.1
2.0.0
2.0.1
2.1.0
2.1.1
2.10.0
2.11.0
2.12.0
2.13.0
2.14.0
2.15.1
2.16.1
2.17.0
2.17.1
2.18.0
2.19.0
2.2.0
2.2.1
2.2.2
2.2.3
2.2.4
2.20.0
2.20.1
2.21.1
*** 2.22.0
2.4.0
2.5.0
2.6.0
2.6.1
2.7.0
2.7.1
2.7.2
2.8.0
2.8.1
2.9.0
2.9.1
2.9.2
2.9.3