How to Allow WPCargo Agent to Access Multiple Package Section

Copy and paste this on your current active theme’s functions.php file:


function wpcfe_shipment_multipackage_template_custom($shipment_id){
    $wpcargo_settings = !empty(get_option('wpc_mp_settings')) ? get_option('wpc_mp_settings') : array();
    if (!array_key_exists('wpc_mp_enable_admin', $wpcargo_settings)) {
        return false;
    }
    $user_roles = wpcfe_current_user_role();
    if (!(in_array('wpcargo_driver', (array)$user_roles))) {
        $shipment = new stdClass();
        $shipment->ID = $shipment_id;
        $template = wpcfe_include_template('multiple-package.tpl');
        require_once($template);
    }
}
function wpcfe_custom_admin_init_callback(){
    remove_action('after_wpcfe_shipment_form_fields', 'wpcfe_shipment_multipackage_template', 10, 1);
    add_action('after_wpcfe_shipment_form_fields', 'wpcfe_shipment_multipackage_template_custom', 10, 1);
}
add_action('init', 'wpcfe_custom_admin_init_callback');

0
    0
    Your Cart
    Your cart is emptyReturn to Shop