Working with orders in the B2B GraphQL API is fairly straightforward. The storefront experience of placing an order, for both B2B and B2C customers, relies on the BigCommerce checkout or use of the standard BigCommerce APIs. Therefore, the GraphQL Storefront API only handles the use case of fetching the details of a company’s existing orders and ordered products.
The order-related queries are available to any of the built-in user roles, or a custom role with the “Orders - View” permission.
The current company’s orders can be fetched with the allOrders query.
allOrders supports typical pagination arguments.beginDateAt and endDateAt, which accept date string values like “2025-01-01”.idand userId) and core BigCommerce IDs (bcOrderId and bcCustomerId) of both the order records and associated customer/user records.companyId contains a company object on which specific fields must be queried.items contains a count of the total items in the order. While this query doesn’t expose a field that returns an array of the order items, note that products contains an encoded JSON string of the full BigCommerce order product details, which can be decoded in your application.products, shippingAddress, shipments, and customer contain JSON strings with full details of the shipping address, shipments (if any), and the associated customer record.A single order’s details can be fetched with the order query using the order’s BigCommerce ID.
Note that order returns a different GraphQL type than the nodes returned by allOrders, and in this case more granular details about the order can be queried than with the “list” query.
Many fields have been truncated from the above example, but note the following details:
price tax_field contains the amount of tax based on the item’s non-discounted price, while total tax_contains the final tax amount.products, billingAddress, shippingAddress, and shipments return complex objects, but their GraphQL types do not allow more granular querying of their sub-fields.orderHistoryEvent contains a history of the order’s status changes.With the orderedProducts query, historical information about a company’s previously ordered products can be queried, including the number of times ordered and first/last ordered dates.
orderedProducts supports standard pagination arguments.minOrderedTimes and maxOrderedTimes arguments.beginDateAt and endDateAt arguments. These arguments accept a date string like “2025-01-01”.