Frequently Asked Questions

How to add a customer to POS staff
on openpos, default on Store staff page, it show the list of user have role : admin or shop manager. 
But with those user with those role, they allow access to admin panel. In some case , you don't want store staff access to admin panel, just POS page only. You can use a customer role to do it . 

Note
:  This custom just effect to display customer to store staff available assign, not became store staff. To became store staff and able access to POS, admin should update field : "Is POS staff" to Yes and assign to a Register.

So, to display user with customer role in Store Staff page, you can add this code to end of your_current_theme/function.php

function op_allow_user_roles($roles)
{     
     $roles[] = 'customer';
     return $roles; 
}
add_filter('op_allow_user_roles','op_allow_user_roles',10,1);

In case you want add a menu with link to POS panel in customer my account page, you can add more this code in enf of file your_current_theme/function.php

if(!function_exists('op_woocommerce_account_menu_items'))
{
    function op_woocommerce_account_menu_items($items,$endpoints)
    {
        $user_id = get_current_user_id();
        if($user_id)
        {
            $allow_pos = get_user_meta($user_id,'_op_allow_pos',true);
            if($allow_pos)
            {
                $items['dashboard-pos'] = __('Open POS','openpos');
            }
        }
        return $items;
    }
}
if(!function_exists('op_woocommerce_get_endpoint_url'))
{
    function op_woocommerce_get_endpoint_url($url, $endpoint)
    {
        $user_id = get_current_user_id();
        if($user_id)
        {
            $allow_pos = get_user_meta($user_id,'_op_allow_pos',true);
            if($allow_pos)
            {
                if($endpoint == 'dashboard-pos')
                {

                    $url = 'https://yoursite.com/wp-content/plugins/woocommerce-openpos/pos/'; // Your current pos url
                }
            }
        }
        return $url;
    }
}
add_filter('woocommerce_account_menu_items','op_woocommerce_account_menu_items',10,2);
add_filter('woocommerce_get_endpoint_url','op_woocommerce_get_endpoint_url',10,2);


 Last updated Thu, Sep 20 2018 12:50am

Please Wait!

Please wait... it will take a second!