I'm trying to build custom export column in WP All Export but I can not get what I'm trying to achieve. I need column 'For Payment', where I need to place actual order total in case the payment method is COD. Otherwise it should return 0 (required by couriers). I tried to modify code below but it doesn't work.
<?php
function cod_payment( $order_id ) {
$total = get_total();
$method = get_payment_method();
if($method == "cod") {
return $total;
} else {
return "0";
}
}
?>
You can do something like this. select Custom export field
add the function call in the text area
[cod_payment({Payment Method},{Order Total})]
and finaly the PHP to the function editor (make sure to save it)
<?php
function cod_payment( $method, $total ) {
if($method == "cod") {
return $total;
} else {
return "0";
}
}
?>
Keep in mind the method name may not be correct.