Access our premium support and let us know your problems, we will help you solve them.

0
No products in the cart.

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: Importing Node Modules With JavaScript #9595
    blankippei-tanaka
    Participant

    If you want to use npm modules via the syntax, like import sth from "something" for browsers, you’d need to set up a module bundler and ES6 compiler, such as Webpack and Babel. You’d need to google them and find tutorials for setting up them accordingly.

    An easy way to use the SDK seems to be using the CDN, since it’s already been built for browsers to understand. Something like:

    index.html

    <script src="http://sdks.shopifycdn.com/js-buy-sdk/v1/latest/index.umd.min.js"></script>
    <script src="javascript/shopify.js"></script>
    

    shopify.js

    const client = ShopifyBuy.buildClient({
        domain: 'your-shop-name.myshopify.com',
        storefrontAccessToken: 'your-storefront-access-token'
    });
    
    console.log(client); 
    
Viewing 1 post (of 1 total)