Can I use variables in input queries in cart and checkout validation function extension?

Hi Lucky-Funny,

Based on your code, it looks like you’re using Shopify’s extension points and metafields to pass values into your query. Here are a few suggestions that might help you resolve the issue:

  1. Double-check your namespace and key values: Ensure that the namespace and key values in your server code match exactly with those defined in the shopify.extension.toml file.

  2. Verify the value of the metafield: The value field in your metaFieldsSet mutation is a JSON string. Make sure it has been correctly formatted and parsed.

  3. Check your GraphQL Query: The issue might be with how you’re trying to access the selectedCollectionIds variable in your query. Ensure that the selectedCollectionIds variable is correctly defined and used in your query.

  4. Use the latest API version: Shopify frequently releases new API versions, so ensure you’re using the most recent version for the most accurate results.

  5. Debugging: If the problem persists, I would recommend debugging your code to see the actual value being passed to selectedCollectionIds. This will help you ascertain whether the problem is the variable not being passed correctly or the query itself.

Try out the above and let us know if you’re still experiencing issues - hope this helps!