How to modify additional charges in WPCargo Parcel Quotation Addons?
List of default fields in Additional Charges and their corresponding keys from the array
- subtotal => ‘wpcpq_subtotal’
- freight => ‘freight’
- fuel => ‘fuel’
- stops => ‘stops’
- layover => ‘layover’
Add field for additional charges
add_filter( 'wpcpq_package_additional_charges', 'add_wpcpq_package_charges' ); function add_wpcpq_package_charges( $package_additional_fields ){ $package_additional_fields['driver'] = array( 'label' => 'Driver', 'field' => 'number', 'required' => false, ); return $package_additional_fields; }
Update field for additional charges
add_filter( 'wpcpq_package_additional_charges', 'add_wpcpq_package_charges' ); function add_wpcpq_package_charges( $package_additional_fields ){ $package_additional_fields['freight'] = array( 'label' => 'Custom Freight Label', 'field' => 'number', 'required' => false, ); return $package_additional_fields; }
Remove field from default additional charges
add_filter( 'wpcpq_package_additional_charges', 'add_wpcpq_package_charges' ); function add_wpcpq_package_charges( $package_additional_fields ){ unset ($package_additional_fields['freight']); unset ($package_additional_fields['wpcpq_subtotal']);</pre> <pre> return $package_additional_fields; }