Product page
How to display price and availability on a product page
Last updated
How to display price and availability on a product page
Last updated
You've created a product page with your favorite CMS and now you want to display the price and the availability of the selected product. You also need to implement the "add to cart" function on the related button.
To retrieve the price and availability of an SKU, send a GET
request to the /api/skus/:id
endpoint and include the associated prices.
The following request retrieves the price and the availability of the SKU identified by the "aBmNkPQRst" ID:
For performance reasons, the inventory
information is only returned when fetching a single SKU.
To implement the "add to cart" function, please refer to this guide:
Adding products to cartThe image below shows the three main dynamic elements of the page (selling price, full price and inventory information) and how each of these are mapped to a specific field of the SKU or price objects.
If you have the SKU code and you want to retrieve the related ID, send a GET
request to the /api/skus
endpoint and filter it by code, taking care to request the ID field only.
The following request retrieves the ID of the SKU identified by the code "TSHIRTB5B5B5XL":
If you need to display the prices associated with a list of SKUs (with no inventory information) send a GET
request to the /api/skus
endpoint, filter it by code, and include the SKU prices.
The following request retrieves the prices of the SKU identified by the "TSHIRTB5B5B5XL" code:
See our documentation if you need more information on how to filter data, include associations, and manage sparse fieldsets or if you want to have an overview of all the specific permissions and restrictions set for a sales channel API client.