3

I'm from Brazil, and here we use the "taxvat" customer field to store a number called "CPF". I managed to make the field appear on checkout by adding it to an layoutProcessor, like this:

      $shippingFields['taxvat'] = [
        'component' => 'Magento_Ui/js/form/element/abstract',
        'label' => __('CPF'),
        'config' => [
            'customScope' => 'shippingAddress',
            'template' => 'ui/form/field',
            'elementTmpl' => 'ui/form/element/input',
        ],
        'placeholder' => 'CPF *',
        'validation' => [
            'required-entry' => 1
        ],
        'provider' => 'checkoutProvider',
        'source' => 'customer.taxvat',
        'dataScope' => 'customer.taxvat',
        'sortOrder' => 1,
    ];

But, i don't know why, this field it's not saving on database. It only works if i save this field on customer form, not on checkout form.

Anyone know what i'm missing?

i want to do that to enable guest checkout (but i need this field)

thanks!

1
  • Did you find a solution?
    – Alex
    Commented Oct 24, 2018 at 13:43

1 Answer 1

0

taxvat does not display in checkout. For the purpose of payment methods that require brazilian CPF, you have to use VatId. The vast majority of payment methods in Brazil use taxvat but it is not meant to guest checkout and will not alow customer to pay with another billing address or someone's else credit card as it is very common in this country because of the economics crisis. You have the option to remap the fields in your custom payment method and instead of taxvat, map vat-id. Also, the mindset of developers in Brazil, I don't know why, have decided that vat-id is CNPJ, but it is not. It is just guest checkout.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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