Hi @coatsy35,
How would I code a function to perform addition? i.e. {Item Tax}+{Item Cost}= ?
You can do that with a custom PHP function in the export: https://www.wpallimport.com/documentation/export/pass-data-through-php-functions/. Here’s an untested example snippet that you can modify as needed:
function my_calculate_prices( $cost, $tax ) {
$return = array();
if ( is_array( $cost ) && is_array( $tax ) ) {
foreach ( $cost as $key => $price ) {
$price = str_replace( ",", "", $price );
$taxes = str_replace( ",", "", $tax[ $key ] );
$return[] = round( $price + $taxes, 2 );
}
return $return;
} else {
$price = str_replace( ",", "", $cost );
$taxes = str_replace( ",", "", $tax );
return round( $price + $taxes, 2 );
}
}
The array part of that function doesn’t work and I’m struggling to see what is wrong? where there are single items it’s fine so the “Else” part is working ok.
Hey @coatsy35,
The array part of that function doesn’t work and I’m struggling to see what is wrong? where there are single items it’s fine so the “Else” part is working ok.
Can you please replicate the issue on a debug site at http://wpallimport.com/debug and open a support request at https://www.wpallimport.com/support/ with the details? We won’t be able to write code for this, but we can make sure all of the export settings are correct, the expected data is being exported, and that the function is being called correctly.