Magento PWA Studio + Retrive Dropdown attributes value (Product) into front end

Viewed 232

I'm developing a ecommerce website using mageto PWA studio.

I have created "Subject" Product dropdown attribute from magento admin panel.

My Requirement is: I have to display the subject value into product detail page.

For that I have added following querys into exiting product page GraphQL query:

1st I tried in following way

export const ProductDetailsFragment = gql`
    fragment ProductDetailsFragment on ProductInterface {
        __typename
        categories {
            id
            breadcrumbs {
                category_id
            }
        }
        description {
            html
        }
        id
        media_gallery_entries {
            id
            label
            position
            disabled
            file
        }
        meta_description
        name
        price {
            regularPrice {
                amount {
                    currency
                    value
                }
            }
        }
        sku
        small_image {
            url
        }
        url_key
        subject
    }
`;

Output: Instead of subject value, It's giving option id of the subject.

2nd I tried in following way

export const ProductDetailsFragment = gql`
    fragment ProductDetailsFragment on ProductInterface {
        __typename
        categories {
            id
            breadcrumbs {
                category_id
            }
        }
        description {
            html
        }
        id
        media_gallery_entries {
            id
            label
            position
            disabled
            file
        }
        meta_description
        name
        price {
            regularPrice {
                amount {
                    currency
                    value
                }
            }
        }
        sku
        small_image {
            url
        }
        url_key
        subject {
            label
            value
        }
    }
`;

Output: Throwing console error


How can I over come from this issue..

0 Answers
Related