B2B GraphQL
Product page
Description
The suite adds wholesale queries and mutations to Magento’s /graphql endpoint. A signed-in buyer can use b2bMyCompany to read the company linked to their account on a specified website.
For whom
For developers connecting a storefront or buyer portal to Magento B2B.
Features
- Read company records and shopping lists.
- Query a product price for a company, website, currency and quantity.
- Create quote requests and add items or comments using mutations.
Installation
Install B2B Suite and check that Kowal_B2BGraphQl and Magento_GraphQl are enabled. B2B Suite installation
Configuration
- Enable B2B for the wholesale website and link a test buyer to an active company.
- Send a POST request to
/graphqlwith the customer’s bearer token. Set theStoreheader to the store-view code and pass the numeric website ID as the query variable.
Requirements / notes
The store-view code and website ID are different identifiers. For b2bMyCompany the token must represent a customer.
FAQ
Why does b2bMyCompany return null?
Check the buyer’s company assignment on the supplied website and the company’s active status. A missing customer token produces an authorization error.
Verify the installation
Run the query below with the variable website set to the wholesale website ID. Compare the returned name and status with the company record in Admin.
query BuyerCompany($website: Int!) {
b2bMyCompany(website_id: $website) { id name status }
}