Skip to content

Instantly share code, notes, and snippets.

@bekarice
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bekarice/62cfca8c65debfb37362 to your computer and use it in GitHub Desktop.
Save bekarice/62cfca8c65debfb37362 to your computer and use it in GitHub Desktop.
Move WooCommerce Coupon form at checkout
/**
* 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