Token
The APIs for obtaining information about cart and checkout tokens.
checkoutToken: string | undefiend
CAUTION
This API can only be used on the checkout page.
The unique identifier for the current checkout.
render("Checkout::Dynamic::Render", (props) => {
const { checkoutToken } = props;
const top = (
<>
{checkoutToken && checkoutToken.includes("test") ? (
<Banner title="Thank you for your visit" />
) : null}
</>
);
return top;
});
cartToken: string | undefined
CAUTION
This API can only be used on the checkout page.
The unique identifier for the cart associated with the checkout. May be undefined.
render("Checkout::Dynamic::Render", (props) => {
const { cartToken } = props;
const top = (
<>
{cartToken && cartToken.includes("test") ? (
<Banner title="Thank you for your visit" />
) : null}
</>
);
return top;
});
useCheckoutToken(): string | undefined
CAUTION
This API can only be used on the checkout page.
Returns the unique identifier for the checkout.
render("Checkout::Dynamic::Render", (props) => {
const checkoutToken = useCheckoutToken();
const top = (
<>
{checkoutToken && checkoutToken.includes("test") ? (
<Banner title="Thank you for your visit" />
) : null}
</>
);
return top;
});
useCartToken(): string | undefined
CAUTION
This API can only be used on the checkout page.
Returns the unique identifier for the cart associated with the checkout. May be undefined.
render("Checkout::Dynamic::Render", (props) => {
const cartToken = useCartToken();
const top = (
<>
{cartToken && cartToken.includes("test") ? (
<Banner title="Thank you for your visit" />
) : null}
</>
);
return top;
});
Was this article helpful to you?