useExtension hook
Learn how to use the useExtension hook to access information about the current account, extension point, and orderFormId in Checkout extensions.
This feature is only available for stores using B2B Buyer Portal, which is currently available to selected accounts.
The useExtension hook allows you to access information about the current account and the extension point in which your extension is running.
Usage
_12import { useExtension } from '@vtex/checkout';_12_12const ExtensionInfo = () => {_12 const { account, extensionPoint } = useExtension();_12_12 return (_12 <div>_12 <p>Account: {account}</p>_12 <p>Extension Point: {extensionPoint}</p>_12 </div>_12 );_12};
Parameters
The useExtension hook does not accept any parameters.
Returns
The useExtension hook returns an object with the following properties:
account
account: string
The current account name where the extension is running.
extensionPoint
extensionPoint: ExtensionPoints
The name of the extension point where your extension is hooked into.
orderFormId
orderFormId: string
The orderFormId for the active cart in Checkout.
Extension Points
This hook is available across all Checkout extension points.