How to change type and remove and make it required input fields in Package Section

Add this code to your child theme’s functions.php file:

How to make fields required in Package section

add_filter( 'wpcargo_package_fields', 'wcp_custom_wpcargo_package_fields', 10, 1 );
function wcp_custom_wpcargo_package_fields( $package_fields ){
    /* Change fields to text */
    $package_fields['wpc-pm-qty']['required'] = true;
    $package_fields['wpc-pm-piece-type']['required'] = true;
    $package_fields['wpc-pm-description']['required'] = true;
    $package_fields['wpc-pm-length']['required'] = true;
    $package_fields['wpc-pm-width']['required'] = true;
    $package_fields['wpc-pm-height']['required'] = true;
    $package_fields['wpc-pm-weight']['required'] = true;
    $package_fields['unit-price']['required'] = true;
    $package_fields['unit-amount']['required'] = true;

    return $package_fields;
}

 

How to remove required in the input fields in Package section

add_filter( 'wpcargo_package_fields', 'wcp_custom_wpcargo_package_fields', 10, 1 );
function wcp_custom_wpcargo_package_fields( $package_fields ){
    /* Change fields to text */
    $package_fields['wpc-pm-qty']['required'] = false;
    $package_fields['wpc-pm-piece-type']['required'] = false;
    $package_fields['wpc-pm-description']['required'] = false;
    $package_fields['wpc-pm-length']['required'] = false;
    $package_fields['wpc-pm-width']['required'] = false;
    $package_fields['wpc-pm-height']['required'] = false;
    $package_fields['wpc-pm-weight']['required'] = false;
    $package_fields['unit-price']['required'] = false;
    $package_fields['unit-amount']['required'] = false;

    return $package_fields;
}


 

How to unset or remove Columns in Package Fields Section

add_filter( 'wpcargo_package_fields', 'wcp_unset_wpcargo_package_fields', 10, 1 );
function wcp_unset_wpcargo_package_fields( $package_fields ){
    /* unset columns in Package fields */
    unset ($package_fields['wpc-pm-qty']);
    unset ($package_fields['wpc-pm-piece-type']);
    unset ($package_fields['wpc-pm-description']);
    unset ($package_fields['wpc-pm-length']);
    unset ($package_fields['wpc-pm-width']);
    unset ($package_fields['wpc-pm-height']);
    unset ($package_fields['wpc-pm-weight']);
    unset ($package_fields['unit-price']); 
    unset ($package_fields['unit-amount']);


    return $package_fields;
}
0
    0
    Your Cart
    Your cart is emptyReturn to Shop