Apply a product discount based on a custom condition

joel-frienzee
Tourist
5 0 1

Hey! I'm still learning the Shopify admin API, and am trying to implement something that, in its simplest form, applies a discount to the current customer, depending on a number. Put simply, the greater that number, the higher the percentage discount goes, up to a % limit/min price predefined by the merchant. This number does have a meaning but for the sake of the question it's not really relevant. I can see a bunch of `buy X get X free` examples. But nothing that lets me simply put a discount based on a custom condition. 

Another question, can you apply a discount on a product, that is only relevant to the person currently looking at the product? I don't want to have to use a discount code, unless I can subtly just inject that into the URL, which could work. 

Just looking for guidance on how this needs to be achieved. Basically, just a product discount, that changes % depending on a number, that's only applied to the user looking at the cart, so not a global discount, as this number is based on the user's actions.

I can be more detailed I just figured this might be enough info to work with.

 

Kind Regards,

Reply 1 (1)

joel-frienzee
Tourist
5 0 1

Some important details I skipped over. I am developing a Shopify sales channel, and it's being built with ReactJS via Shopify CLI. I'm interacting with the backend via graphql mutations.