Place the CPF field at checkout, in Magento 2

Asked

Viewed 691 times

0

Does anyone know how to put the CPF field in the Magento2 checkout? There are several tips out there on how to put in previous versions of Magento, but I found nowhere how to do this in the new version (I’m currently in 2.2.3).

I was able to place the field using 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 he’s not saving in the database.

Someone knows how to do?

Thank you!

  • already managed to put the CPF at checkout?

  • I did. I used VAT as a field. And in the payment plugin, I took the taxvat or the VAT field, depending on which user filled in (taxvat if logged in, VAT if used guest checkout). I used the moip plugin for magento2 as a reference.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.