-
-
Save bekarice/62cfca8c65debfb37362 to your computer and use it in GitHub Desktop.
Move WooCommerce Coupon form at checkout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Moves the WooCommerce form to enter a coupon code at checkout above order details rather than at the top of the page | |
* Tutorial: http://www.sellwithwp.com/move-the-woocommerce-coupon-field/ | |
**/ | |
// Remove the coupon form from the top of checkout & re-add it above the order review | |
remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 ); | |
add_action( 'woocommerce_review_order_before_cart_contents', 'woocommerce_checkout_coupon_form' ); | |
/** | |
* Optional: Change the coupon message because the form javascript is teh broke | |
* The form will just stay open rather than have the 'accordion' effect, but you could fix it instead if preferred | |
**/ | |
add_filter( 'woocommerce_checkout_coupon_message', 'sww_change_wc_coupon_message' ); | |
function sww_change_wc_coupon_message( $message ) { | |
return 'Have a coupon? Enter your code and click "Apply Coupon".'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment