Looking for help?
< All Topics
Print

Disallow view order from other Register Orders

If you want disallow your staff can view other register orders. you can add this shortcode to yourtheme/functions.php or use any snippets code plugin

function custom_op_latest_order_query_args($args){
    global $op_session_data;
    $login_cashdrawer_id = $op_session_data['login_cashdrawer_id'];
    $args['meta_query'] = array(
        array(
            'key'     => '_pos_order_cashdrawer',
            'value'   => $login_cashdrawer_id,
            'compare' => '=',
        ),
    );
    
    return $args;
}
add_filter('op_latest_order_query_args','custom_op_latest_order_query_args',20,1);
function custom_2_op_get_online_order_data($order_data){
    global $op_session_data;
    $login_cashdrawer_id = $op_session_data['login_cashdrawer_id'];
    $order_id = $order_data['order_id'];
    $_pos_order_cashdrawer = get_post_meta($order_id,'_pos_order_cashdrawer',true);
    if(!$_pos_order_cashdrawer || $_pos_order_cashdrawer != $login_cashdrawer_id )
    {
        return array();
    }
    return $order_data;
}
add_filter('op_get_online_order_data','custom_2_op_get_online_order_data',11,1);
Table of Contents