I want to display sale bubble in WooCommerce only for logged in users.
I have a function which hides sale-bubble for unlogged users but if I log in there is showing only value “1” instead of sale-bubble.
I know why, because I am returning a true, but I cant figure out how to return sale-bubble instead of true..
WooCommerce
add_filter('woocommerce_sale_flash', 'woo_custom_hide_sales_flash');
function woo_custom_hide_sales_flash()
{
if ( is_user_logged_in() ) {
return true;
}
return false;
}
3
Answers
Use the shortcode where you want to output the bubble. You can add the css in the global css file.
You are not using this filter hook in the right way. Try the following:
Code goes in functions.php file of your active child theme (or active theme). Tested and works.
my problem solve using this code you can place any ware you want to display sale badge