0

There is a block in /customer/account/create page named ANONYMOUS_55. It is created by Mage_Customer_Block_Widget_Taxvat. I would like to remove this block from layout but both remove or unsetChild methods are not working. Any ideas why?

This is the code I used in local.xml:

<?xml version="1.0"?>
<layout version="0.1.0">
<customer_account_create>
    <reference name="customer_form_register">
        <remove name="ANONYMOUS_55" />
    </reference>
</customer_account_create>
</layout>
  • That block adding at before html? – kunj May 16 '18 at 11:27
1

You can show/hide Tax/VAT field from system configuration:

System > Config > Customers > Customer Configuration > Name and Address Options > Show Tax/VAT Number


tltr:

I think it isn't possible via layout update.

Theoretically you could add an observer to core_layout_block_create_after and use somethink like this:

public function unsetTaxBlock(Varien_Event_Observer $observer)
{
    $block = $observer->getBlock();
    if ($block instanceof Mage_Customer_Block_Widget_Taxvat) {
        $block->getLayout()->unsetBlock($block->getNameInLayout());
    }
}

BUT, in this would give you an error in registration form, because you would call isEnabled() on null.

        <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
        <?php if ($_taxvat->isEnabled()): ?>

You could change it to <?php if ($_taxvat && $_taxvat->isEnabled()): ?> ...

Is there anything wrong using config settings?

|improve this answer|||||
  • I appreciate for your suggestion. I agree. The main goal based on GDPR regulations, no more VAT collecting in Frontend for humans. But for checkout process I have to show the input box for VAT number because in my country it is necessary being mentioned on Invoices for companies and humans. It will not be a required field, if someone is not providing it I can prove I requested it according to the legislation. – ADDISON74 May 17 '18 at 11:57
  • @ADDISON74 You can set it as required or optional from config. Making it optional should be OK for (german) GDPR. – sv3n May 17 '18 at 12:21
  • GDPR is good but some people got crazy. We received complains why there is an input box for VAT (optional) when creating an account. So, I set "Show Tax/VAT Number" value to No. For checkout I had to set "Show VAT Number in Frontend" to Yes. In order to get no trouble when VAT could be required in the future, I set its value to UNSPECIFIED for every new account. – ADDISON74 May 17 '18 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.