0

I wanted to get product custom selected options values and labels etc with Query how can i get this ?

This Query gets all the available options and selections but how can i get the selected

{
  customerCart {
    id
    email
    items {
      id
      quantity
      product {
        id
        sku
        name
        __typename
        ... on CustomizableProductInterface {
          options {
            uid
            title
            required
            sort_order
            option_id
            ... on CustomizableDropDownOption {
              value {
                option_type_id
                price
                price_type
                sku
                sort_order
                title
              }
            }
            ... on CustomizableRadioOption {
              value {
                option_type_id
                price
                price_type
                sku
                sort_order
                title
              }
            }
            ... on CustomizableCheckboxOption {
              value {
                option_type_id
                price
                price_type
                sku
                sort_order
                title
              }
            }
          }
        }
      }
    }
  }
}
1

2 Answers 2

0

You can use this query to fetch Custom Selected Options value and label of Simple and Configurable type of products.

{
    customerCart {
      id
      email
      items {
        id
        quantity
        ... on SimpleCartItem {
          customizable_options {
            label
            values {
              label
              value
            }
          }
        }
        ... on ConfigurableCartItem {
          configurable_options {
            option_label
            value_label
          }
          customizable_options {
            label
            values {
              label
              value
            }
          }
        }
        ... on DownloadableCartItem {
          customizable_options {
            label
            values {
              value
              price {
                value
                units
              }
            }
          }
          links {
            title
            sample_url
            price
          }
        }
        product {
          id
          sku
          name
          __typename
        }
      }
    }
  }
2
  • I want to get the options of downloadable products like the selected link etc Commented Oct 6, 2023 at 11:35
  • @SyedHassanZamir Updated the query. Please review and Accept answer if works Commented Oct 10, 2023 at 11:02
0

Please Try Below Query

{
  cart(cart_id: "82R4S0kC5PWxDXyZ6KtwG8BWGqueQQFj") {
    total_quantity
    items {
      id
      quantity
      ... on ConfigurableCartItem {
        customizable_options {
          label
          values {
            value
          }
        }
        configurable_options {
          id
          option_label
          value_id
          value_label
        }
      }
      ... on SimpleCartItem {
        customizable_options {
          label
          values {
            value
          }
        }
      }
      ... on BundleCartItem {
        bundle_options {
          label
          values {
            label
            quantity
          }
        }
      }
      ... on DownloadableCartItem {
        links {
          title
          price
        }
      }
      ... on VirtualCartItem{
        customizable_options{
          label
          values {
            label
            value
          }
        }
      }
      product {
        name
        sku
        image {
          url
          label
          position
        }
        price_tiers {
          quantity
          final_price {
            value
          }
          discount {
            amount_off
            percent_off
          }
        }
      }
      prices {
        price {
          currency
          value
        }
        row_total{
          currency
          value
        }
        row_total_including_tax{
          currency
          value
        }
        discounts{
          label
          amount {
            currency
            value
          }
        }
        total_item_discount{
          currency
          value
        }
      }
    }
    prices {
      applied_taxes {
        label
        amount {
          value
        }
      }
      discounts {
        label
        amount {
          value
        }
      }
      subtotal_including_tax{
        currency
        value
      }
      subtotal_excluding_tax {
        value
      }
      subtotal_with_discount_excluding_tax{
        currency
        value
      }
      grand_total{
        currency
        value
      }
    }
  }
}

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.