The documentation here implies that you can filter on a metafield boolean value. I have create serveral metafields on products.
- toggle Active
- namespace: ‘custom’
- key: ‘toggle_active’
- value : boolean ( true or false)
- toggle_message
- namespace: ‘custom’
- key: ‘toggle_message’
- value : “Last chance to purchase”
I would like to return all of the collection products that have a metafield boolean value of true. I tried creating the following query, with a metafield value of boolean. Howerver, the grapqhl will not accept it as a boolean. It will only accept strings, like “true” which does not work, or throws an error saying the value must be a string
query getCollectionToggleProducts($handle: String) {
collection(handle: $handle) {
products(
first: 8
filters: {productMetafield: {key: "toggle_active", namespace: "common", value: "True"}}
) {
edges {
node {
title
}
}
}
}
How can I create a query that will filter on a productMetafield that has a value of boolean true?