Skip to content

Instantly share code, notes, and snippets.

@bradleysa
Last active July 6, 2017 09:36
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradleysa/3cc0b5cf1d5d287a9ef5 to your computer and use it in GitHub Desktop.
Save bradleysa/3cc0b5cf1d5d287a9ef5 to your computer and use it in GitHub Desktop.
WooCommerce: Check if Coupon Already Applied
<?php
/**
* WooCommerce: Hide 'Coupon form' on checkout page if a coupon was already applied in the cart
* Add to theme functions.php file or Code Snippets plugin
*/
add_filter( 'woocommerce_coupons_enabled', 'woocommerce_coupons_enabled_checkout' );
function woocommerce_coupons_enabled_checkout( $coupons_enabled ) {
global $woocommerce;
if ( ! empty( $woocommerce->cart->applied_coupons ) ) {
return false;
}
return $coupons_enabled;
}
@bradleysa
Copy link
Author

Stack Overflow: WooCommerce check if coupon already applied?
http://stackoverflow.com/questions/17626814/woocommerce-check-if-coupon-already-applied

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment