This API object is provided to extensions registered for the `purchase.checkout.pickup-point-list.render-before` or `purchase.checkout.pickup-point-list.render-after` extension targets. It extends the [`StandardApi`](/docs/api/checkout-ui-extensions/apis/standardapi) and provides a [`isLocationFormVisible`](#properties-propertydetail-islocationformvisible) boolean to indicate whether the customer location input form is currently rendered and shown to the buyer.
import {
reactExtension,
useApi,
useSubscription,
Text,
} from '@shopify/ui-extensions-react/checkout';
export default reactExtension(
'purchase.checkout.pickup-point-list.render-before',
() => <Extension />,
);
function Extension() {
const {isLocationFormVisible} =
useApi<'purchase.checkout.pickup-point-list.render-before'>();
const locationFormShown = useSubscription(
isLocationFormVisible,
);
if (locationFormShown) {
return (
<Text>
The customer is being asked to provide
their location.
</Text>
);
} else {
return (
<Text>Pickup points are being shown.</Text>
);
}
}
import {extension} from '@shopify/ui-extensions/checkout';
export default extension(
'purchase.checkout.pickup-point-list.render-before',
(root, {isLocationFormVisible}) => {
const content = root.createText(
getTextContent(
isLocationFormVisible.current,
),
);
root.appendChild(content);
isLocationFormVisible.subscribe(
(updatedLocationFormVisible) => {
content.updateText(
getTextContent(
updatedLocationFormVisible,
),
);
},
);
function getTextContent(
isLocationFormVisible,
) {
if (isLocationFormVisible) {
return 'The customer is being asked to provide their location.';
} else {
return 'Pickup points are being shown.';
}
}
},
);
See the [StandardApi examples](/docs/api/checkout-ui-extensions/apis/standardapi#examples) for more information on how to use the API.
Whether the customer location input form is shown to the buyer.