Skip to main content

ShopPayButton

The ShopPayButton component renders a button that redirects to the Shop Pay checkout. It renders a <shop-pay-button> custom element, for which it will lazy-load the source code automatically.

Anchor to ShopPayButtonStyleProps

ShopPayButtonStyleProps

string

A string of classes to apply to the div that wraps the Shop Pay button.

string

A string that's applied to the CSS custom property (variable) --shop-pay-button-width for the Buy with Shop Pay component.

string

The domain of your Shopify storefront URL (eg: your-store.myshopify.com).

Anchor to ShopPayVariantAndQuantities

ShopPayVariantAndQuantities

Anchor to variantIdsAndQuantities
variantIdsAndQuantities
Array<{ id: string; quantity: number; }>
required

An array of variant IDs and quantities to purchase with Shop Pay.

never

An array of IDs of the variants to purchase with Shop Pay. This will only ever have a quantity of 1 for each variant. If you want to use other quantities, then use variantIdsAndQuantities.

string[]
required

An array of IDs of the variants to purchase with Shop Pay. This will only ever have a quantity of 1 for each variant. If you want to use other quantities, then use variantIdsAndQuantities.

Anchor to variantIdsAndQuantities
variantIdsAndQuantities
never

An array of variant IDs and quantities to purchase with Shop Pay.

Examples
import {ShopPayButton} from '@shopify/hydrogen';

export function AddVariantQuantity1({variantId, storeDomain}) {
return <ShopPayButton variantIds={[variantId]} storeDomain={storeDomain} />;
}

export function AddVariantQuantityMultiple({variantId, quantity, storeDomain}) {
return (
<ShopPayButton
variantIdsAndQuantities={[{id: variantId, quantity}]}
storeDomain={storeDomain}
/>
);
}
Was this page helpful?