Coupons Minimum/Maximum Spend
-
Dear WooCommerce Support,
I hope this message finds you well. I’m currently working on a WooCommerce store and need to modify the logic that handles the “Minimum Spend” and “Maximum Spend” functionality for coupons. Specifically, I need the total cart amount to include products that do not qualify for the coupon when determining whether the minimum or maximum spend criteria are met.
After reviewing the core WooCommerce file
WC_Discounts
(located inwoocommerce/includes/class-wc-discounts.php
), I see that theapply_coupon
andvalidate_coupon_minimum_amount
functions are responsible for handling this logic. However, I understand that directly editing core WooCommerce files is not recommended as it could lead to issues during future updates.Could you please advise on the safest approach to modify this behavior? Is there a specific action, filter, or hook available that would allow me to extend or override this functionality without directly modifying the core files? Alternatively, is there another recommended method (such as extending the class via a plugin) that I can use to safely implement this custom logic?
I look forward to your guidance on how to proceed.
Thank you for your assistance!
- You must be logged in to reply to this topic.