I have checked similar questions but couldn't resolve the problem.
This is my code so far:
// Add VAT and SSN fields in billing address display
add_filter( 'woocommerce_order_formatted_billing_address', 'custom_add_vergi_dairesi_vergi_no_formatted_billing_address', 10, 2 );
function custom_add_vergi_dairesi_vergi_no_formatted_billing_address( $fields, $order ) {
$fields['vergi_dairesi'] = $order->billing_vergi_dairesi;
$fields['vergi_no'] = $order->billing_vergi_no;
return $fields;
}
It is giving me this error: "billing_vergi_dairesi was called incorrectly. Order properties should not be accessed directly".
So I replaced $order->billing_vergi_dairesi;
and $order->billing_vergi_no;
with $order->get_billing_vergi_dairesi();
and $order->get_billing_vergi_no();
Then I got: "uncaught Error: Call to undefined method".
What I am doing wrong?