plugin custom logic
-
I have a variable that I can echo
global $woocommerce; var_dump($woocommerce->cart->cart_contents_count);
that returns 0 if the cart is empty and an integer greater than 0 if it has contents.In my custom plugin I put the following
add_filter( 'if_menu_conditions' , 'my_cart_condition' ); function my_cart_condition() { global $woocommerce; return( $woocommerce->cart->cart_contents_count > 0 ); }
this empties the if drop down in the admin section of the plugin.
even an empty function does the same.
add_filter( 'if_menu_conditions' , 'my_cart_condition' ); function my_cart_condition() { }
What am I doing wrong?
Thanks for your help.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘plugin custom logic’ is closed to new replies.