0

I'm having trouble getting the uid for my Configurable product options via GraphQL.

Testing with this simplified query:

{
    products(filter: { url_key: { eq: "test-product" } }) {
        items {
            sku
            ... on ConfigurableProduct {
                configurable_options {
                    attribute_code
                    values {
                        uid
                        label 
                    }
                }
            }
        }
    }
}

Remove uid and the query works fine. With it, the response is Error: Cannot query field "uid" on type "ConfigurableProductOptionsValues".

Similarly, I have the same issue with ConfigurableProductOptions and attribute_uid (attribute_id and attribute_id_v2 both work, but the docs suggest using attribute_uid instead)

Even if I use the exact examples in the documentation, I get the same error.

Is this an environment setup issue? Or maybe the documentation is incorrect? Can't figure it out. Thanks for any help.

1 Answer 1

0

Try This

{
  products(filter: { url_key: { eq: "breathe-easy-tank" } }) {
    items {
      id
      __typename
      sku
      name
      stock_status
      ... on ConfigurableProduct {
        configurable_options {
          id
          attribute_id_v2
          use_default
          attribute_code
          label
          position
          values {
            value_index
            label
            swatch_data {
              __typename
              value
            }
          }
          product_id
        }
        variants {
          attributes {
            uid
            label
            code
            value_index
          }
          product {
            id
            name
            sku
            stock_status
          }
        }
      }
      ... on CustomizableProductInterface {
        options {
          __typename
          option_id
          title
          required
          sort_order
          ... on CustomizableFieldOption {
            product_sku
            optvalue: value {
              uid
              max_characters
              price
              price_type
              sku
            }
          }
          ... on CustomizableAreaOption {
            product_sku
            optvalue: value {
              uid
              max_characters
              price
              price_type
              sku
            }
          }
          ... on CustomizableDropDownOption {
            value {
              uid
              option_type_id
              title
              sku
              price
              price_type
              sort_order
            }
          }
          ... on CustomizableRadioOption {
            value {
              uid
              option_type_id
              title
              sku
              price
              price_type
              sort_order
            }
          }
          ... on CustomizableCheckboxOption {
            value {
              uid
              option_type_id
              title
              sku
              price
              price_type
              sort_order
            }
          }
          ... on CustomizableMultipleOption {
            value {
              uid
              option_type_id
              title
              sku
              price
              price_type
              sort_order
            }
          }
          ... on CustomizableDateOption {
            product_sku
            optvalue: value {
              uid
              price
              price_type
              sku
            }
          }
        }
      }
    }
  }
}

I Hope This Helps You.

4
  • Thanks for your answer. However I'm still missing the uid in the configurable_options values - do you know why the uid in particular doesn't work in the configurable_options section?
    – Ben C
    Commented Feb 14, 2021 at 23:48
  • Please explain your problem. and what you want to achieve ? And configurable_options uid in the variants->attributes->uid please check it again.
    – Msquare
    Commented Feb 15, 2021 at 3:54
  • Thank you, I understand that uid is available in items->variants->attributes->uid, however I'm trying to get uid inside items->configurable_options->values->uid. According to the docs example here this should be possible, but I receive the error in my question above. Thanks!
    – Ben C
    Commented Feb 15, 2021 at 23:31
  • this query is wrong devdocs.magento.com/guides/v2.4/graphql/interfaces/… please refer my answer.
    – Msquare
    Commented Feb 16, 2021 at 4:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.