Skip to content

Instantly share code, notes, and snippets.

@seoindex
Last active January 12, 2017 11:29
Show Gist options
  • Save seoindex/1032eb5cd4748619873c8a61b2920973 to your computer and use it in GitHub Desktop.
Save seoindex/1032eb5cd4748619873c8a61b2920973 to your computer and use it in GitHub Desktop.
Woocommerce - Applicare sconto se è presente un prodotto specifico nel carrello
function check($product_id) {
global $woocommerce;
 
foreach($woocommerce->cart->get_cart() as $key => $val ) {
$_product = $val['data'];
 
if($product_id == $_product->id ) {
return true;
}
}
 
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment