useRedirect hook
This feature is only available for stores using B2B Buyer Portal, which is currently available to selected accounts.
The useRedirect hook allows an extension to redirect the user to another page.
This hook is only available in some extension points.
Usage
_13const CustomButton = () => {_13 const { redirect } = useRedirect();_13_13 const handleClick = () => {_13 redirect("https://www.example.com");_13 };_13_13 return (_13 <button onClick={handleClick}>_13 My Button_13 </button>_13 );_13};
Parameters
The useRedirect hook does not accept any parameters.
Returns
The useRedirect hook returns an object with the following property:
redirect: (url: string) => Promise<void>
The url is the destination URL. It must be a complete URL, such as https://www.example.com.
Extension Points
This hook is available in the following extension point:
punchout.order-summary.cta