Hide Price for Non-Wholesale only in a specific category
-
I added this snipped in the functions.php
add_filter('wwp_hide_price_and_add_to_cart_button', 'hide_price_and_cart', 10, 1); function hide_price_and_cart($non_wholesale_user) { global $current_user, $wc_wholesale_prices; $user_wholesale_role = $wc_wholesale_prices->wwp_wholesale_roles->getUserWholesaleRole(); if (isset($current_user)) { if (empty($user_wholesale_role)) { $non_wholesale_user = true; add_filter('wwp_display_replacement_message', function ($message) { $message = '<a href="' . get_permalink(wc_get_page_id('myaccount')) . '">' . __('Register as wholesale customer to see prices', 'woocommerce-wholesale-prices') . '</a>'; return $message; }); } } return $non_wholesale_user; }
I want to make it apply only on certain categories and not on all products.
Can you help me?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Hide Price for Non-Wholesale only in a specific category’ is closed to new replies.