Magento 2 How to get Products with CustomOptions in GraphQL

In this artical we will show you how to get products with custom options. CustomizableProductInterface attributes can be used in any products query.

The following query returns information about the customizable options configured for the product with a sku of any.


{ products(filter: {sku: {eq: "24-MB01"}}) { items { id name sku __typename ... on CustomizableProductInterface { options { title required sort_order option_id ... on CustomizableDropDownOption{ value{ option_type_id price price_type sku sort_order title } } } } } } }


{ "data": { "products": { "items": [ { "id": 1, "name": "Joust Duffle Bag", "sku": "24-MB01", "__typename": "SimpleProduct", "options": [ { "title": "Custom Options", "required": true, "sort_order": 1, "option_id": 1 } ] } ] } } }

That's it!!

If you are looking for more GraphQL solutions then check out our another article which is List of GraphQL Queries and Mutations for Magento 2.

I hope this article helps you to find what you were looking for.

Bookmark it for your future reference. Do comment below if you have any other questions on that.

P.S. Do share this article with your team.

Recent Articles
Chrome Extension
Copyright © 2024 All rights reserved.
Ads OFF toggle_off