--- title: usePurchasingCompany description: >- Provides information about the company and its location that the business customer is purchasing on behalf of during a B2B checkout. It includes details that can be utilized to identify both the company and its corresponding location to which the business customer belongs. The value is `undefined` if a business customer isn't logged in. This function throws an error if the app doesn't have access to customer data. api_version: 2023-07 api_name: checkout-ui-extensions source_url: html: >- https://shopify.dev/docs/api/checkout-ui-extensions/2023-07/react-hooks/buyer-identity/usepurchasingcompany md: >- https://shopify.dev/docs/api/checkout-ui-extensions/2023-07/react-hooks/buyer-identity/usepurchasingcompany.md --- # use​Purchasing​Companyhook Requires access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data) for some properties. Provides information about the company and its location that the business customer is purchasing on behalf of during a B2B checkout. It includes details that can be utilized to identify both the company and its corresponding location to which the business customer belongs. The value is `undefined` if a business customer isn't logged in. This function throws an error if the app doesn't have access to customer data. ## use​Purchasing​Company() ### Returns * PurchasingCompany | undefined ### PurchasingCompany Information about a company that the business customer is purchasing on behalf of. * company Includes information of the company that the business customer is purchasing on behalf of. {% include /apps/checkout/privacy-icon.md %} Requires access to \[protected customer data]\(/docs/apps/store/data-protection/protected-customer-data). ```ts Company ``` * location Includes information of the company location that the business customer is purchasing on behalf of. {% include /apps/checkout/privacy-icon.md %} Requires access to \[protected customer data]\(/docs/apps/store/data-protection/protected-customer-data). ```ts CompanyLocation ``` ```ts export interface PurchasingCompany { /** * Includes information of the company that the business customer is purchasing on behalf of. * * {% include /apps/checkout/privacy-icon.md %} Requires access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data). */ company: Company; /** * Includes information of the company location that the business customer is purchasing on behalf of. * * {% include /apps/checkout/privacy-icon.md %} Requires access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data). */ location: CompanyLocation; } ``` ### Company * id The company ID. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to \[protected customer data]\(/docs/apps/store/data-protection/protected-customer-data). ```ts string ``` * name The name of the company. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to \[protected customer data]\(/docs/apps/store/data-protection/protected-customer-data). ```ts string ``` * externalId The external ID of the company that can be set by the merchant. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to \[protected customer data]\(/docs/apps/store/data-protection/protected-customer-data). ```ts string ``` ```ts export interface Company { /** * The company ID. * * {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data). */ id: string; /** * The name of the company. * * {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data). */ name: string; /** * The external ID of the company that can be set by the merchant. * * {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data). */ externalId?: string; } ``` ### CompanyLocation * id The company location ID. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to \[protected customer data]\(/docs/apps/store/data-protection/protected-customer-data). ```ts string ``` * name The name of the company location. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to \[protected customer data]\(/docs/apps/store/data-protection/protected-customer-data). ```ts string ``` * externalId The external ID of the company location that can be set by the merchant. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to \[protected customer data]\(/docs/apps/store/data-protection/protected-customer-data). ```ts string ``` ```ts export interface CompanyLocation { /** * The company location ID. * * {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data). */ id: string; /** * The name of the company location. * * {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data). */ name: string; /** * The external ID of the company location that can be set by the merchant. * * {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data). */ externalId?: string; } ``` ## Related [APIs - StandardApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/standardapi) [APIs - CheckoutApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/checkoutapi) [APIs - OrderStatusApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/orderstatusapi) [APIs - CartLineItemApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/cartlineitemapi) [APIs - PickupPointListApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/pickuppointlistapi) [APIs - PickupLocationListApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/pickuplocationlistapi) [APIs - ShippingOptionItemApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/shippingoptionitemapi) [APIs - ExtensionTargets](https://shopify.dev/docs/api/checkout-ui-extensions/apis/extensiontargets)