Downloadable product data types
The DownloadableProduct
data type implements ProductInterface
and CustomizableProductInterface
. As a result, attributes that are specific to downloadable products can be used when performing a products
query. It also implements RoutableInterface.
Sample query
Add the following inline fragment to the output section of your products
query to return information specific to downloadable products:
Copied to your clipboard... on DownloadableProduct {items {<attributes>}}
The following query returns information about downloadable product 240-LV04
, which is defined in the sample data.
Request:
Copied to your clipboard{products(filter: { sku: { eq: "240-LV04" } }) {items {uidnamesku__typenameprice_range{minimum_price{regular_price{valuecurrency}}}... on DownloadableProduct {links_titlelinks_purchased_separatelydownloadable_product_links {sample_urlsort_ordertitleuidprice}downloadable_product_samples {titlesort_ordersample_url}}}}}
Response:
Copied to your clipboard{"data": {"products": {"items": [{"uid": "NDc=","name": "Beginner's Yoga","sku": "240-LV04","__typename": "DownloadableProduct","price_range": {"minimum_price": {"regular_price": {"value": 6,"currency": "USD"}}},"links_title": "Downloads","links_purchased_separately": 0,"downloadable_product_links": [{"sample_url": "http://example.com/downloadable/download/linkSample/link_id/1/","sort_order": 1,"title": "Beginner's Yoga","uid": "ZG93bmxvYWRhYmxlLzE=","price": 6}],"downloadable_product_samples": [{"title": "Trailer #1","sort_order": 1,"sample_url": "http://example.com/downloadable/download/sample/sample_id/1/"},{"title": "Trailer #2","sort_order": 1,"sample_url": "http://example.com/downloadable/download/sample/sample_id/2/"},{"title": "Trailer #3","sort_order": 1,"sample_url": "http://example.com/downloadable/download/sample/sample_id/3/"}]}]}}}