For discussing the development and usage of Checkout UI extensions, post-purchase extensions, web pixels, Customer Accounts UI extensions, and POS UI extensions
I've recently started on a custom checkout extensibility that adds a new text box and edits an attribute. That is working and can see the data changing. Is there a way for it to only show that box if the customer is logged in?
Solved! Go to the solution
This is an accepted solution.
I've done it with the useCustomer hook. Not sure if there is a simpler way.
This is an accepted solution.
I've done it with the useCustomer hook. Not sure if there is a simpler way.
Thank you for the answer.
So for example it would be something like this:
import {
reactExtension,
Banner,
BlockStack,
Checkbox,
Text,
TextField,
useApi,
useApplyAttributeChange,
useInstructions,
useTranslate,
useApplyNoteChange,
useAttributes,
useCustomer
} from "@shopify/ui-extensions-react/checkout";
function Extension() {
const { extension } = useApi();
const c = useCustomer();
if(!c){
//do customer only code.
}
}
I'm new to React.