Created
November 20, 2017 06:27
-
-
Save Luminus/8b1340ac28afd7db3d27f6bb305b90d2 to your computer and use it in GitHub Desktop.
Hide Coupon Form from the Cart & Checkout Pages if there's a Deposit Product in the Cart
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
<?php | |
// hide coupon form from the cart and checkout pages if there's a deposit product in the cart | |
function hide_coupon_field( $enabled ) { | |
if ( is_cart() || is_checkout() ) { | |
if ( class_exists( 'WC_Deposits_Cart_Manager' ) ) { | |
if ( WC_Deposits_Cart_Manager::has_deposit() ) { | |
$enabled = false; | |
} | |
} | |
} | |
return $enabled; | |
} | |
add_filter( 'woocommerce_coupons_enabled', 'hide_coupon_field' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment