Last updated: Jul-29-2024
You can use GraphQL to retrieve specific product details from Cloudinary and utilize that information within Magento. This guide explains how to retrieve product information using GraphQL parameters, including an example of retrieving product details for a particular SKU.
Note
This solution also supports headless implementations.
On this page:
Query overview
The GraphQL query to Cloudinary fetches the following product details for a product with a specific SKU:
- Product name
- SKU
- Cloudinary data, including image URLs and gallery widget parameters
Query request
Querying GraphQL for product details from Cloudinary requires a specific structure. For example, this query retrieves product details for the SKU "WS12":
Query breakdown
The following parameters need to be included in your request:
-
products
: The main query field to fetch products. -
filter
: Specifies the criteria for fetching products. -
sku: { eq: "WS12" }
: Filters the product by SKU "WS12". -
items
: Contains the list of products matching the filter. -
name
: The name of the product. -
sku
: The SKU of the product. -
cld_data
: The Cloudinary data to include for the product. -
image
: URL of the main product image. -
small_image
: URL of the small product image. -
media_gallery
: Array of URLs for additional media assets. -
gallery_widget_parameters
: JSON string with media gallery parameters.
Sample response
The response will include the product details as specified. Here’s an example:
✖️