Documentation
Feedback
Guides
API Reference

Guides
Guides

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


_12
import { useExtension } from '@vtex/checkout';
_12
_12
const 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.

Contributors
1
Photo of the contributor
Was this helpful?
Yes
No
Suggest Edits (GitHub)
Contributors
1
Photo of the contributor
Was this helpful?
Suggest edits (GitHub)
On this page