Okay
  Public Ticket #2981208
How to avoid editing the price of a product to a group of specific agents if the option is selected at the configuration level.
Closed

Comments

  • amursuli started the conversation

    How to avoid editing the price of a product to a group of specific agents if the option is selected at the configuration level.

  •  1,906
    WebWizards replied

    Hi there,

    Thank you for getting in touch,

    It's not possible to set this differently for specific products. The way it works is that you can configure a "maximum allowed discount" for your agents (e.g. 5%), and then agents can discount all product prices by a maximum of that number (5%).

    Let me know if I can help with anything, or if you have any questions,

    Kind regards,

    Stefan


  • amursuli replied

    Hi Stefan, thanks for the quick response.

    The idea is that a group of agents cannot increase the price of the products, so this cannot be possible?

  •  1,906
    WebWizards replied

    Hi again,

    There's a setting for this in SalesKing -> Settings -> Agent Capabilities -> Agents can edit prices to increase price. This setting is only global (for all agents).


    However, we can assist you, as part of support, with a PHP code snippet that enables/disables this option for specific agent groups. Such a snippet would be added to functions.php or by using a snippets plugin.


    Kind regards,

    Stefan

  • amursuli replied

    Thank you very much again,

    I'd appreciate it if you'd provide me with that snippet for function.php. 

    Best regard

  •  1,906
    WebWizards replied

    You can use the following snippet for that:

    add_filter('salesking_agents_can_edit_prices_increase_setting', function($val){
        $disable_group_id = 1234;
        // get agent group
        $user_id = get_current_user_id();
        $user_group = get_user_meta($user_id,'salesking_group', true);
        if (intval($user_group) === $disable_group_id){
            // disable for specific group
            $val = 0;
        }
        
        return $val;
    }, 10, 1);
    

    You would need to replace 1234 with the ID of your group. To get the agent group ID, you can go to SalesKing -> Agent Groups -> click on the group. The number in the url is the ID (for example if the URL contains ?post=123, then the ID is 123).


    A PHP snippet can be added to functions.php, or by following our guide here: https://woocommerce-b2b-plugin.com/docs/how-to-add-a-snippet-php-or-js/


    Let me know if I can help with anything, or if you have any questions,

    Kind regards,

    Stefan