Customize schema.graphql and input.graphql with more attributes?

Hello,

Is it possible to customize schema.graphql and input.graphql with more attributes?

Such as the product tag, title, variant price, etc.

A few example use cases:

  • Compare the product tags of one item in cart against all other items to determine if discount is applicable (i.e. if product has tag, discount all other products with tag)
  • Use part of the product title as a discount condition (suffix, prefix)
  • Use variant price as a discount condition (if subtotal of a set of variants is greater than an amount, apply discount)

etc

Thank you.

Hello,

I want to do the same thing, except add something extra for the buyerIdentity. Did you ever get an answer to this?

No, this schema represents the data provided by that Function API. Function APIs are document here:
https://shopify.dev/docs/api/functions

Some of the data you mention here is already available, others are coming in 2023-07. If you think something important is missing, I’d recommend putting in a feature request here:
https://github.com/Shopify/function-examples/discussions

Hi

Is it possible to get the Company object metafield using graphql. Please let me know how to resolve this. I get this error:

Command failed with exit code 1: npm exec – graphql-code-generator --config package.json
[FAILED] GraphQL Document Validation failed with 1 errors;
[FAILED] Error 0: Cannot query field “company” on type “Input”.
[FAILED] at C:/Users/xyz/shopify-functions/lucrative-consumer-app/extensions/cart-checkout-validatio
n/src/run.graphql:14:3
[STARTED] Parse Configuration
FYI: I am trying to acheive this using custom app(https://shopify.dev/docs/apps/build/checkout/cart-checkout-validation/create-simple-validation-rules)

Thanks,

Khasim