GraphQL
The GraphQL package adds queries for individual customer price records and paginated lists.
Install the package
composer require mageb2b/pricesystem-customerprice-graph-ql:*
php bin/magento setup:upgrade
php bin/magento cache:flush
Queries
| Query | Use |
|---|---|
customerprice(id: Int!) |
Read one record by ID |
customerprices(filter, pageSize, currentPage) |
Search records available to an authorized caller |
myCustomerprices(filter, pageSize, currentPage) |
Read prices for the signed-in customer |
Use a customer token for myCustomerprices. The query derives the customer from the authenticated session rather than accepting another customer's ID.
query MyCustomerPrices {
myCustomerprices(pageSize: 20, currentPage: 1) {
total_count
items {
id
customer_id
product_id
qty
value
website_id
}
}
}
Request only the fields the storefront needs and paginate list queries. GraphQL reads records; use the REST API or Magento Import/Export for write workflows.