How To Merge Parcel Quote Additional Charges Fields with Invoice Total Fields

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


function wpcinvoice_total_fields_callback( $array ) {
    // get parcel quote's additional charges fields
    $wpcpq_add_charges = wpcpq_package_additional_charges();
    // unset tax from parcel quote's additional charges fields
    unset( $wpcpq_add_charges['tax-cost'] );
    // merge the invoice total fields and parcel quote additional charges fields
    $result = array_slice($array, 0, 2, true) + $wpcpq_add_charges + array_slice($array, 2, count($array) - 1, true);
    // return merged fields
    return $result;
}
add_filter('wpcinvoice_total_fields', 'wpcinvoice_total_fields_callback', 10, 1 );

0
    0
    Your Cart
    Your cart is emptyReturn to Shop