Skip to main content

CartCheckoutButton
component

The CartCheckoutButton component renders a button that redirects to the checkout URL for the cart.

Must be a descendent of a CartProvider component.

ReactNode
required

Any ReactNode elements.

AsType

Provide a React element or component to render as the underlying button. Note: for accessibility compliance, almost always you should use a button element, or a component that renders an underlying button.

(event?: MouseEvent<HTMLButtonElement, MouseEvent>) => boolean | void

A default onClick behavior

Ref<HTMLButtonElement>

A ref to the underlying button

Was this section helpful?

Example code

import {CartCheckoutButton} from '@shopify/hydrogen-react';

export default function ProductCartCheckoutButton() {
return <CartCheckoutButton />;
}