How to make the checkbox extension required

How to make the checkbox extension required

a_zelinsky
Shopify Partner
24 0 4

Hi, I need to make a checkbox required before clicking on "Pay Now". How can I change this extension's code to make it required? Thank you!

import {render, Checkbox} from '@shopify/checkout-ui-extensions-react';
render('Checkout::Dynamic::Render', () => <Extension />);
function Extension() {
  return (
    <Checkbox id="checkbox" name="checkbox">
      Save this information for next time
    </Checkbox>
  );
}
Reply 1 (1)

lizk
Shopify Staff
246 58 74

Hi there 👋

I would recommend taking a look at this tutorial for adding validation to your Checkout UI Extension.

You will need to use the BuyerJourney Intercept to block the checkout progress if the checkbox is not checked.

To learn more visit the Shopify Help Center or the Community Blog.