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.

Buy 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:

Attributes

Attribute Required? Description
store-url Yes The online store URL. For example, https://graphql.myshopify.com.
variants Yes The product variants, separated by commas. You can obtain the product's variant ID either from the Shopify admin, or through the Admin or Storefront API.

Hosting

The Buy with Shop Pay component is hosted on the Shopify CDN:

  • https://cdn.shopify.com/shopifycloud/shop-js/client.js (latest)
  • https://cdn.shopify.com/shopifycloud/shop-js/v0.1/client.js (versioned)

Include 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:

Where to get help

Shopify's Web Components aren't supported by Shopify support, but there are other places where you can get help.

Shopify Community forums

Visit our forums to connect with the community and learn more about the Shopify API and App development.

Shopify Experts

Find an Expert for hire in our ecosystem of talented development agencies.