Okay
  Public Ticket #3637971
Stop sales rep from editing orders
Closed

Comments

  •  2
    Renan Braz started the conversation

    Hello, 

    I would like to know how can I stop the sales rep from editing any of the order informations. Specially the status. 

    I already tried editing the roles of the agent on wordpress, but it doesn't make much difference. 


    Best regards 

    5996855159.png



    Attached files:  Imagem1.png

  •  2,214
    WebWizards replied

    Hello Renan,

    You can add the following PHP code snippet to your site to remove the various options and buttons that allow the agent to edit the order:

    add_action('admin_head', function(){
        if (is_agent(get_current_user_id())){
            ?>
            <style>
                #woocommerce-order-actions, .edit_address, .add-items{
                    display: none !important;
                }
            </style>
            <script>
                jQuery(document).ready(function(){
                    jQuery('#woocommerce-order-actions, .edit_address, .add-items').remove();
                });
            </script>
            <?php
        }
    });
    function is_agent($user_id){
        $agent_group = get_user_meta($user_id,'salesking_group',true);
        if ($agent_group !== 'none' && !empty($agent_group)){
            return true;
        } else {
            return false;
        }
    }
    

    This 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 you need anything else, any button or area there to be removed, and I can adjust the snippet for that,


    Kind regards,

    Stefan