Question

I updated a project from Magento 1.5 to Magento 1.7.0.2. In the latest Mage CE Version we have vat_id attribute in customer_address. During checkout this field is used to validate a customer for 0% tax calculation. This all works fine.

Strange thing however is that when var_dumping customer_address_entity the vat_id field is not present. The other vat_* related fields are however.

I need the field to update the data in addresses for existing customers that have an old customer_entity related taxvat attribute value.

Anyone an idea on how I can access the vat_id field or where it even is?

Was it helpful?

Solution

Customer is an EAV model, so check wether isPartialLoad if yes, then you need to load the vat_id.

There are the ugly, bad, don't do it way:

$customer->load($customer->getId())

Or the clean way:

Search the function and the setting what makes the attribute to be loaded :) Change it and everything is fine. If the customer is fully loaded, something is wrong.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top