Created
May 5, 2017 01:37
-
-
Save jaworowicz/d3d085a19903d853f616045a57ba6991 to your computer and use it in GitHub Desktop.
Automatyczne kupony rabatowe WooCommerce
This file contains hidden or 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', 'jcz_automatyczny_kupon' ); | |
function jcz_automatyczny_kupon() { | |
global $woocommerce; | |
$kupon = 'jaworowicz'; // Zmien nazwę kodu | |
if ( $woocommerce->cart->has_discount( $kupon ) ) return; | |
if ( $woocommerce->cart->cart_contents_total >= 1 ) { | |
$woocommerce->cart->add_discount( $kupon ); | |
$woocommerce->show_messages(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment