Web Components
Web Components are a collection of web standards that allow the creation of components that act as standard elements. Web Components encapsulate their style and HTML and are supported by all modern browsers. You can use components as you would use a <div>
or <input />
, and can also integrate them with any JavaScript library or framework that works with HTML.
You can use Web Components provided by Shopify to embed certain user interface (UI) components.
Some of Shopify's Web Components haven't been tested on IE11.
Anchor to Storefront Web ComponentsStorefront Web Components
Storefront Web Components are ready-to-use custom elements that let you integrate Shopify functionality into any website by embedding HTML code. With these components, you can build:
-
Product cards and detail pages
-
Collection listings
-
Shopping cart with quick checkout
Learn more and see examples at the Storefront Web Components playground or reference docs.
Anchor to Buy with Shop Pay componentBuy with Shop Pay component
The Buy with Shop Pay component allows you to integrate a Shop Pay button on any website for one or more preconfigured products. It directs the buyer to an accelerated buy-it-now checkout flow. Buyers who are already signed in with Shop Pay can review their order and confirm in a single tap. The component uses the Checkout Links functionality and adheres to the Shop Pay branding guidelines. View an implemented Shop Pay component:
Anchor to AttributesAttributes
Attribute | Required? | Description |
---|---|---|
store-url | Yes | The online store URL. For example, https://graphql.myshopify.com . |
variants | Yes | The product variants, separated by commas (the format with quantities variant_id:quantity is also supported). You can obtain the product's variant ID either from the Shopify admin, or through the Admin or Storefront API. |
Anchor to HostingHosting
The Buy with Shop Pay component is hosted on the Shopify CDN:
https://cdn.shopify.com/shopifycloud/shop-js/modules/v2/loader.pay-button.esm.js
Anchor to Include and instantiate the componentInclude and instantiate the component
The following code snippet shows how to include the required JavaScript bundle containing the Web Component, and add it to a web page:
Anchor to Where to get helpWhere to get help
Shopify's Web Components aren't supported by Shopify support, but there are other places where you can get help.
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.