I am new to shopify and trying to understand how shopify app works. I am aware how to create an app and how to install on my development store. I have few questions around developing apps.
Lets take an example of a resource picker where the app allows you to select products and it allows you to set discount price in %. There is a button to remove the discount as well.
The merchant selects 3 products and sets a discount for them to 10%. we have a mutation query that updates the price on the selected products. so when the customer sees it they will see 10% off price. Great!
Now the questions
1) When the user removes the app, does this mutation query gets nulled? like how does it get handled?
2) When the merchant selects these products for discount, i am assuming it is just one time mutation query, Any customers at that point will see the discounted price only? correct?
3) Lets say the ways this offer can end are
a) Merchant removes the discount
b) Expiry date
In both of this condition app should have written again a mutation query to revert to original price? is that correct? if yes is there any guide on how to do it? or do i just calculate current price based off the discount?
One last question:
4) For something that needs to be dynamically calculated, for example Shipping price free if no of items > 3. This doesnt look like run one time thing, since customers can continuously change. How does that work then?
Please forgive me, I've tried my best to go through online resources, but wasnt able to find any answers. It will be great if you can help me understand.