How to enable package fields accepts decimal value and change input field type

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

Note: Please copy this code into your functions.php of your current active theme

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']['field'] = 'text';
    $package_fields['wpc-pm-piece-type']['field'] = 'text';
    $package_fields['wpc-pm-description']['field'] = 'text';
    $package_fields['wpc-pm-length']['field'] = 'text';
    $package_fields['wpc-pm-width']['field'] = 'text';
    $package_fields['wpc-pm-height']['field'] = 'text';
    $package_fields['wpc-pm-weight']['field'] = 'text';
    $package_fields['unit-price']['field'] = 'text';

//if you have added a custom column in the package section
 //  $package_fields['custom_column']['field'] = 'text';

    return $package_fields;
}




/****Note: Change the 'custom_column' into the metakey you used ****/

Adding more columns in the package section.


add_filter( 'wpcargo_package_fields', 'shipping_cost_package_fields_callback', 10, 1 );

function shipping_cost_package_fields_callback( $fields ){

$fields['unit-price'] = array(
'label' => __('Shipping Cost '.$currency, 'wpcargo-invoice'),
'field' => 'text',
'required' => '',
'options' => array()
);
$fields['unit-amount'] = array(
'label' => __('Cost '.$currency, 'wpcargo-invoice'),
'field' => 'text',
'required' => '',
'options' => array()
);

return $fields;
}

2
    2
    Your Cart
    Remove
    WPCargo Merchant Package
    2 X $429.90 = $859.80
    Remove
    WPCargo Parcel Quotation Package
    1 X $333.90 = $333.90