Skip to main content

QRCode

Used to quickly access scannable data.

string
Default: 'QR code' (translated to the user’s locale)

A label that describes the purpose or contents of the QR code. When set, it will be announced to users using assistive technologies and will provide more context about what the QR code may do when scanned.

Extract<, 'none' | 'base'>
Default: 'base'

Adjust the border style.

string

The content to be encoded in the QR code, which can be any string such as a URL, email address, plain text, etc. Specific string formatting can trigger actions on the user’s device when scanned, like opening geolocation coordinates on a map, opening a preferred app or app store entry, preparing an email, text message, and more.

string

A unique identifier for the component.

string

URL of an image to be displayed in the center of the QR code. This is useful for branding or to indicate to the user what scanning the QR code will do. By default, no image is displayed.

() => void

Invoked when the conversion of content to a QR code fails. If an error occurs, the QR code and its child elements will not be displayed.

'auto' | 'fill'
Default: 'auto'

The displayed size of the QR code.

fill: the QR code will takes up 100% of the available inline-size and maintain a 1:1 aspect ratio.

auto: the QR code will be displayed at its default size.

Was this section helpful?

Basic QR Code

import {
reactExtension,
Link,
QRCode,
TextBlock,
} from '@shopify/ui-extensions-react/checkout';

export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
return (
<>
<QRCode content="https://shopify.com" />

<TextBlock>
Scan to visit{' '}
<Link to="https://shopify.com">
Shopify.com
</Link>
</TextBlock>
</>
);
}

Preview

  • Always test that the QR code is scannable from a smartphone.
  • Include a square logo if that’s what your customers are familiar with.
  • Increase usability by adding a text description of what the QR code does.
  • Always provide an alternate method for customers to access the content of the QR code.
    • If the content is a URL, provide a Link nearby.
    • If the content is data, provide a Button to copy the data to the clipboard, or show the data in a readonly TextField.
Was this section helpful?

In most cases the default size should work well. If you need a different size, use fill to make it grow to the size of its parent container.

Anchor to example-copying-content-of-a-qr-code-to-the-user's-clipboardCopying content of a QR code to the user's clipboard

When displaying a QR code, include an alternative way for the user to get the content

Was this section helpful?

With logo

import {
reactExtension,
Link,
QRCode,
TextBlock,
} from '@shopify/ui-extensions-react/checkout';

export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
return (
<>
<QRCode
content="https://shopify.com"
logo="https://cdn.shopify.com/YOUR_IMAGE_HERE"
/>

<TextBlock>
Scan to visit{' '}
<Link to="https://shopify.com">
Shopify.com
</Link>
</TextBlock>
</>
);
}

Preview