I’ve been trying to modify this shopify dev tutorial for building a discounts function to apply a discount to each product in a customer’s cart based on its variant title and/or SKU.
Here’s the tutorial I’m talking about:
https://shopify.dev/docs/apps/build/discounts/experience/build-discounts-function
I can’t seem to find a way to reference the variant title or SKU values in “run.js”.
The tutorial makes use of the cart item’s quantity to make a discount, which seems to be made available through the “run.graphql” file.
What I would like is to access the product’s variant title and SKU to make a condition that replaces that “line.quantity >= 2” condition in line 28 of the “run.js” file.
Basically, if a product’s SKU has the string “ONG” in it, or the product variant’s title contains “Orange”, have the discount applied to that.

