Pricelist prices: query on originType

Hi ShopifyDev’s,

I’m searching for a way to sync pricelist prices in a efficient way. Currently I’m making this query:

query PriceLists {
  priceList(id:"gid://shopify/PriceList/11111111"){
    id
    name
    fixedPricesCount
    parent {
      adjustment {
        type
        value
      }
      settings {
        compareAtMode
      }
    }
    catalog {
      id
      status
    }
    prices(first:1 //Missing the originType query){
      pageInfo {
        endCursor
        hasNextPage
      }
      nodes {
        originType
        variant {
          id
          product {
            id
          }
        }
        compareAtPrice {
          amount
        }
        price {
          amount
        }
      }
    }
  }
}

Where you can see that I have 34 fixed prices but an adjustment of value 0.0 so I would like to only fetch the FIXED prices because those are the ones that are different.

{
  "id": "gid://shopify/PriceList/111111111",
  "name": "PriceList name",
  "fixedPricesCount": 34,
  "parent": {
    "adjustment": {
      "type": "PERCENTAGE_DECREASE",
      "value": 0.0
    },
    "settings": {
      "compareAtMode": "ADJUSTED"
    }
  }
}

Now inside the priselist.prices I cannot query on originType:FIXED. Is there an other way to sync only the 34 prices and not my 70K product catalog for each pricelist there is?

Hi @AdminGh! The prices connection on PriceList actually does accept an originType argument. Pass originType: FIXED and it’ll return only the prices you’ve manually set on the price list, skipping the relative ones entirely.

query PriceListFixedPrices {
  priceList(id: "gid://shopify/PriceList/11111111") {
    id
    name
    fixedPricesCount
    prices(first: 250, originType: FIXED) {
      pageInfo {
        endCursor
        hasNextPage
      }
      nodes {
        originType
        variant {
          id
          product {
            id
          }
        }
        compareAtPrice {
          amount
        }
        price {
          amount
        }
      }
    }
  }
}

The PriceListPriceOriginType enum has two values: FIXED for prices set directly on the price list, and RELATIVE for ones calculated from the parent adjustment. With 34 fixed prices you should get everything in a single page without touching the 70K catalog.

Can you give it a go and see if it works for you?

@Donal-Shopify,

Ah great! I was searching in the query section instead of the argument section.

1 Like