Created
January 12, 2017 11:30
-
-
Save seoindex/3e3f215138586261c097f4a697a48bad to your computer and use it in GitHub Desktop.
Woocommerce - Applicare sconto in modo automatico
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
add_action( 'woocommerce_before_cart', 'apply_matched_coupons' ); function apply_matched_coupons() { global $woocommerce; $coupon_code = '10percento'; // titolo del coupon if ( $woocommerce->cart->has_discount( $coupon_code ) ) return; if ( $woocommerce->cart->cart_contents_total >= 500 ) { // valore minimo del carrello $woocommerce->cart->add_discount( $coupon_code ); $woocommerce->show_messages(); } } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment