Adding coupon to order not working
-
The new versions of WooCommerce now allow adding coupons to existing orders by using the “Apply Coupon” button on the order edit page.
If you create a coupon with a role restriction, it will incorrectly take the role of the admin instead of getting the role of the customer for that particular order.
So a coupon with a specific role restriction can never be added to an order because it will say “Sorry, it seems this coupon is not for you”.
FIX:
WCECF_Controller.php line#441 and line#453:
Instead of using wp_get_current_user(), it should instead get the order customer ID and check role if the object is a WC_Order.
The topic ‘Adding coupon to order not working’ is closed to new replies.