I would like to print the VAT number (provided by module vat_number) on the invoice PDFs generated by module commerce_billy, but I can not figure out, how to retrieve VAT number when an order ID is given.
1 Answer
It took me a while to figure it out, but now I've found an answer myself:
$profile_id = $order->content['commerce_customer_eu_vat_rc']['#items'][0]['profile_id'];
$profile_wrapper = commerce_customer_profile_load($profile_id);
$vat_id = $profile_wrapper->commerce_vat_number['und'][0]['value'];