question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`variantBySelectedOptions` Not working as intended?

See original GitHub issue

We are running this Query:

{
  node(id: "Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0LzIyMzg2NjA2MTA1") {
    ... on Product{
      title
      handle
      variantBySelectedOptions(selectedOptions: [{ name:"Region", value:"NA"}]) {
        id
      }
    }
  }
}

And getting null back on the variant, even though we know that a product exists, what are we doing wrong?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jsbaguettecommented, Nov 8, 2019

nothing is working … Maybe it’s time to re open the issue ?

{
  collectionByHandle(handle: "women-sale-dresses") {
    title
    products(first: 1) {
      edges {
        node {
          title
          options {
            id
            name
            values
          }
          variantBySelectedOptions(selectedOptions: [
            {name: "Color", value: "G178"}]) {
            title
            product {
              id
              title
            }
          }
        }
      }
    }
  }
}
{
  "data": {
    "collectionByHandle": {
      "title": "Women's Sale Dresses",
      "products": {
        "edges": [
          {
            "node": {
              "title": "BASIA DRESS",
              "options": [
                {
                  "id": "i hide the id",
                  "name": "Size",
                  "values": [
                    "L",
                    "M",
                    "S",
                    "XL",
                    "XS"
                  ]
                },
                {
                  "id": "i hide the id",
                  "name": "Color",
                  "values": [
                    "G178",
                    "N101",
                    "P424"
                  ]
                }
              ],
              "variantBySelectedOptions": null
            }
          }
        ]
      }
    }
  }
}
0reactions
rebeccajfriedmancommented, Dec 18, 2019

We’ve resolved the issue with ordering as described above. Thank you for reporting it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Querying Selected Options in Storefront API
Hey, Im trying to use the storefront API to pull up a product variant using the variantBySelectedOptions field, but the documentation isn't ......
Read more >
Shopify's `min/maxVariantPrice` filtering doesn't work as ...
I have a product whose variant price is 15, if I replace 10 with 15 in the above query I see that product...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found