I have a client who wants to add a coupon for WordPress/WooCommerce checkout. Normally I would just go to WooCommerce > Coupons and create the coupon.
However, they want one coupon code to give a product discount to TWO separate products. Products in this case are admission tickets.
- coupon code name is = "COUPON1"
- "PRODUCT A" is $15.95 on weekdays (product ID = 2846)
- "PRODUCT A" is $17.95 on weekends (product ID = 2848)
- "PRODUCT B" is $10.95 on weekdays (product ID = 2847)
- "PRODUCT B" is $12.95 on weekends (product ID = 2849)
- PRODUCT A discount is $11.95 for both weekday and weekend tickets
- PRODUCT B discount is $8.95 for both weekday and weekend tickets
Workflow:
- User adds 1 ticket for PRODUCT A to cart
- User adds 1 ticket for PRODUCT B to cart
- User enters coupon COUPON1 to discount field
- WordPress hook notices these products in cart by their ID and notices that the coupon COUPON1 has been applied
- WordPress creates the discounted prices for PRODUCTS A and B
- Subtotal now shows $11.95 + $8.95 = $20.90
I can create one coupon code for the $15.95 weekend and weekday tickets but it can't be applied to the second product (PRODUCT B).
The discount to $11.95 should be applied IF the coupon is applied and IF any of the product IDs 2846 or 2848 are in the cart.
The discount to $8.95 should be applied IF the coupon is applied and IF any of the product IDs 2847 or 2849 are in the cart.
I figured there is probably a webhook that can be written that will do this for me.
Thanks in advance.