We want to create a coupon for 5% off on any order that ships within the California state.
This basically should check if the state of California is selected at the checkout. If it is, then that coupon should be allowed to be applied.
Is this possible in any way on Shopify? Seems like a basic feature, I am surprised it is not within Shopify core features.
So, this is not intended to automatically detect a user is from California by their IP address, but just pull the value of the checkout state, and then for this specific user create a coupon for 5% off of everything?
If I got that correctly, there are two ways to go about this:
1. If you'd like the coupon code to be unique to each customer (i.e. LeslieKnopeCalifornia5Percent), you could generate it automatically once the user has checked out, send the customer an e-mail with that code and automatically apply it to every other product that ships within the state of California.
2. If you'd just like a coupon code to be available for all orders in the state of California, once you know that user's from there (i.e. California5Percent), you could do that without generating the code automatically.
So, to put it in other words, this is how the flow looks like from my perspective;
1. Customer selects "California" at checkout
2. Discount code is generated or the fly (or pulled from the list of available Discount code, as it is a generic one that was created beforehand)
3. Discount code is automatically applied to the subset of products that ship in California for that customer's session
4. Discount code is sent to customer via e-mail.
If I'm on the money there, let me know and I'll actually walk you through how this can happen with a dev store (or your own store if you ping me personally).
In either case, you'd need to access the list of all your products that ship within California (can be done manually or automatically with a query), access to the user's checkout state (has to be done automatically)