GraphQL - Price Rules - No value or value_type

Solved
querybuilderapp
New Member
3 0 0

Hi all,

I would like to ask how I can get the value and value_type of a price rule over GraphQL.

When I take a look at REST API, the value and value_type have been returned

https://shopify.dev/docs/admin-api/rest/reference/discounts/pricerule#show-2021-01

querybuilderapp_0-1610535413887.png


But when I try to look up these values in GraphQL I have no clue where I can get the values.
There is no equivalent value_type and the "valueV2" gives me nothing.

 

querybuilderapp_1-1610535522797.png

Do you have any idea where I can the values from?

Thank you.

 

0 Likes
Greg_Kujawa
Shopify Partner
1016 83 243

This is an accepted solution.

Try this.

{
  priceRules(first: 5, reverse:true) {
    edges {
      node {
        id
        title
        status
        valueV2 {
          __typename
          ... on PricingPercentageValue {
            percentage
          }
          ... on MoneyV2 {
            amount
            currencyCode
          }
        }
      }
    }
  }
}
0 Likes
querybuilderapp
New Member
3 0 0

Thank you @Greg_Kujawa , I've learnt something new.

0 Likes