How do I center the shopify buy button?

New Member
4 0 0

I'm trying to insert the piece of code onto my how it works page via the Shopify Buy Button featured and it keeps becoming off centered.


I tried the <center> tags but nothing is working.

 

<div id='product-component-d4885319c68'></div>
    <script type="text/javascript">
    /*<![CDATA[*/

    (function () {
      var scriptURL = 'https://sdks.shopifycdn.com/buy-button/latest/buy-button-storefront.min.js';
      if (window.ShopifyBuy) {
        if (window.ShopifyBuy.UI) {
          ShopifyBuyInit();
        } else {
          loadScript();
        }
      } else {
        loadScript();
      }

      function loadScript() {
        var script = document.createElement('script');
        script.async = true;
        script.src = scriptURL;
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(script);
        script.onload = ShopifyBuyInit;
      }

      function ShopifyBuyInit() {
        var client = ShopifyBuy.buildClient({
          domain: 'luna-wellness.myshopify.com',
          storefrontAccessToken: 'bc4807a218d905e45685b2ad6032c993',
        });

        ShopifyBuy.UI.onReady(client).then(function (ui) {
          ui.createComponent('product', {
            id: [497626415146],
            variantId: 13997702348842,
            node: document.getElementById('product-component-d4885319c68'),
            moneyFormat: '%24%7B%7Bamount%7D%7D',
            options: {
  "product": {
    "variantId": "13997702348842",
    "width": "240px",
    "contents": {
      "img": false,
      "imgWithCarousel": false,
      "title": false,
      "variantTitle": false,
      "options": false,
      "price": false,
      "description": false,
      "buttonWithQuantity": false,
      "quantity": false
    },
    "text": {
      "button": "SHOP NOW"
    },
    "styles": {
      "product": {
        "text-align": "left",
        "@media (min-width: 601px)": {
          "max-width": "100%",
          "margin-left": "0",
          "margin-bottom": "50px"
        }
      },
      "button": {
        "background-color": "#0097e9",
        ":hover": {
          "background-color": "#0088d2"
        },
        ":focus": {
          "background-color": "#0088d2"
        }
      },
      "compareAt": {
        "font-size": "12px"
      }
    }
  },
  "cart": {
    "contents": {
      "button": true
    },
    "styles": {
      "button": {
        "background-color": "#0097e9",
        ":hover": {
          "background-color": "#0088d2"
        },
        ":focus": {
          "background-color": "#0088d2"
        }
      },
      "footer": {
        "background-color": "#ffffff"
      }
    }
  },
  "modalProduct": {
    "contents": {
      "img": false,
      "imgWithCarousel": true,
      "variantTitle": false,
      "buttonWithQuantity": true,
      "button": false,
      "quantity": false
    },
    "styles": {
      "product": {
        "@media (min-width: 601px)": {
          "max-width": "100%",
          "margin-left": "0px",
          "margin-bottom": "0px"
        }
      },
      "button": {
        "background-color": "#0097e9",
        ":hover": {
          "background-color": "#0088d2"
        },
        ":focus": {
          "background-color": "#0088d2"
        }
      }
    }
  },
  "toggle": {
    "styles": {
      "toggle": {
        "background-color": "#0097e9",
        ":hover": {
          "background-color": "#0088d2"
        },
        ":focus": {
          "background-color": "#0088d2"
        }
      }
    }
  },
  "productSet": {
    "styles": {
      "products": {
        "@media (min-width: 601px)": {
          "margin-left": "-20px"
        }
      }
    }
  }
}
          });
        });
      }
    })();
    /*]]>*/
    </script>

0 Likes
New Member
4 0 0

Nevermind,  got it!

0 Likes
Highlighted
New Member
1 0 0

<center> 

 

all the code button ...

 

 

</center>

0 Likes