• Resolved donahmar

    (@donahmar)


    Hi there,
    I have access levels where users cannot view product pages for specific product tags. However, these products still appear on the shop/archive pages and they can add to cart from that page. Is it possible to remove these products from shop/archive pages for specific access levels OR remove the ‘add to cart’ button on these pages for those users?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Joachim Jensen

    (@intoxstudio)

    Hi,

    Yes, RUA does not automatically hide restricted content from lists. The Visibility Control add-on will do that, but currently it does not support doing it by product category/tag.

    If you are able to edit the theme template files, you can do something like this with the RUA API:

    if(rua_get_user()->has_level($level_id)) {
        //show "add to cart"
    }
    

    I hope this helps!

    Thread Starter donahmar

    (@donahmar)

    Hi! Thanks for getting back to me.
    I currently have this code in place to SHOW the add to cart button on all products EXCEPT products in the “out-of-state” category.

    function hideAddtoCartforOutofState () {
    if (!has_term('out-of-state', 'product_tag')) {
    woocommerce_template_loop_add_to_cart();
    }
    }
    
    add_action('woocommerce_after_shop_loop_item', 'hideAddtoCartforOutofState', 20);

    Now, I want to make it SHOW the add to cart button on all products EXCEPT products in the “out-of-state” category AND if the user is in the “out-of-state” access level. Currently, it still hides the button for users outside of this access level, which is not what I want. How would I incorporate the code above to make that happen?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Hide Products/Add to Cart button’ is closed to new replies.