Home Forums WoodMart support forum HIDE SIZE GUIDE TO GUEST USER

HIDE SIZE GUIDE TO GUEST USER

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #74142

    WebMpt
    Participant

    Hi there,

    I need to hide size guide content for no logged user. It’s into according add-on on product page

    Here link of page:
    http://www.pendrivepersonalizzate.it/demo/prodotto/variable-product-example/#1534976319058-663a1b83-4c8e

    I try this snippet but need to add filter before and instead of $html put $content?
    ———————————————————————————–
    add_action (‘after_setup_theme’,’active_filter’);

    function active_filter () {
    add_filter (‘show_html_logged’);
    }

    function show_html_logged ($html) {
    if (is_user_logged_in () ) {
    return $html;
    }
    else
    {
    remove_action (‘vc_tta-panel-body’,’wpb_raw_code wpb_content_element wpb_raw_html’) ;
    return ‘<span class=”login_price”>Login per visualizzare i prezzi</span>‘;
    }
    }

    ———————————————————————————–

    Many thanks,
    Fabio

    #74146

    Artem Temos
    Keymaster

    Hi,

    By default, there is no such option in WPBakery page builder. It may require some additional customization to achieve that.

    Sorry, but we don’t understand how your code supposes to work. Where did you get that?

    Regards

    #74151

    WebMpt
    Participant

    Is a usual code to hide price to guest user, but I need to hide size guide to guest user.
    Link pasted before.

    add_action (‘after_setup_theme’,’active_filter’);

    function active_filter () {
    add_filter (‘woocommerce_get_price_html’,’show_price_logged’);
    }

    function show_price_logged ($price) {
    if (is_user_logged_in () ) {
    return $price;
    }
    else
    {
    remove_action (‘woocommerce_after_shop_loop_item’,’wooocommerce_template_loop_add_to_cart’);
    remove_action (‘woocommerce_single_product_summary’,’wooocommerce_template_single_add_to_cart’, 30);
    remove_action (‘woocommerce_single_variation’, ‘woocommerce_single_variation_add_to_cart_button’, 20 );
    return ‘<span class=”login_price”>Login per visualizzare i prezzi</span>‘;
    }
    }

    #74157

    Artem Temos
    Keymaster

    This code works with WooCommerce hooks but there are not similar hooks in WPBakery element so you can’t apply it there.

Viewing 4 posts - 1 through 4 (of 4 total)