Okay
  Public Ticket #3527396
Sales Agents Stock
Closed

Comments

  •  15
    Darren Robinson started the conversation

    Hi Stefan,

    Currently anyone with the 'reps' user role can see the available stock. I would like it so only sales agents shopping as a customer can see the stock quantites?

    You gave me some code previously that only allows sales agents shopping as a customer to see the products on back order and i wondered if this is possible with the stock levels so only sales agents shopping as a customer can see stock?

    Thanks for your time

    Darren

  •  2,218
    WebWizards replied

    Hi Darren,

    If you still have the previous code snippet on your site, I believe it should work to do the following:


    1. In WooCommerce -> Settings -> Products -> Inventory, set it to https://prnt.sc/8qOlCcg4IxRM

    2. Add this PHP snippet to your site:

    add_filter('option_woocommerce_stock_format', function($val){
        if (check_user_is_agent() or check_is_agent()){
            return '';
        }
        return $val;
    }, 10, 1);
    


    Let me know if that works for you,


    Kind regards,

    Stefan

  •  15
    Darren Robinson replied

    Thanks Stefan, This seems to work fine.


    Darren