Skip to content

Add missing "VAT Number" field to customer registration page #31321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<element name="stateProvinceFill" type="input" selector="#region"/>
<element name="zip" type="input" selector="#zip"/>
<element name="country" type="select" selector="#country"/>
<element name="vatId" type="input" selector="#vat_id"/>
<element name="saveAddress" type="button" selector="[data-action='save-address']" timeout="30"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,23 @@ $formData = $block->getFormData();
</div>
</div>

<?php if ($addressHelper->isVatAttributeVisible()): ?>
<?php $_vatidValidationClass = $addressHelper->getAttributeValidationClass('vat_id'); ?>
<div class="field taxvat">
<label class="label" for="vat_id">
<span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('vat_id') ?></span>
</label>
<div class="control">
<input type="text"
name="vat_id"
value="<?= $escaper->escapeHtmlAttr($formData->getVatId()) ?>"
title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('vat_id') ?>"
class="input-text <?= $escaper->escapeHtmlAttr($_vatidValidationClass) ?>"
id="vat_id">
</div>
</div>
<?php endif; ?>

<div class="field country required">
<label for="country" class="label">
<span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('country_id') ?></span>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="StoreFrontCheckVatIdAtAccountCreateWithMultishipmentTest">
<annotations>
<features value="Multishipment"/>
<stories value="Checking vat id field at account create page with 'Check Out with Multiple Addresses'"/>
<title value="Checking vat id field at account create page with 'Check Out with Multiple Addresses'"/>
<description value="'VAT Number' field should be available at create account page if 'Show VAT Number on Storefront' is Yes"/>
<severity value="MAJOR"/>
<testCaseId value="MC-40397"/>
<group value="Multishipment"/>
</annotations>
<before>
<magentoCLI command="config:set customer/create_account/vat_frontend_visibility 1" stepKey="showVatNumberOnStorefrontYes"/>
<createData entity="SimpleSubCategory" stepKey="category"/>
<createData entity="SimpleProduct" stepKey="product">
<requiredEntity createDataKey="category"/>
</createData>
</before>
<after>
<magentoCLI command="config:set customer/create_account/vat_frontend_visibility 0" stepKey="showVatNumberOnStorefrontNo"/>
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCacheAfter">
<argument name="tags" value="config"/>
</actionGroup>
<deleteData createDataKey="category" stepKey="deleteCategory"/>
<deleteData createDataKey="product" stepKey="deleteproduct"/>
</after>
<!-- Add product to the cart -->
<amOnPage url="$$product.name$$.html" stepKey="goToProductPage"/>
<actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProductToCart">
<argument name="productName" value="$$product.name$$"/>
</actionGroup>
<!-- Check Out with Multiple Addresses -->
<actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openCart"/>
<waitForElementVisible selector="{{MultishippingSection.shippingMultipleCheckout}}" stepKey="waitMultipleAddressShippingButton"/>
<click selector="{{MultishippingSection.shippingMultipleCheckout}}" stepKey="clickToMultipleAddressShippingButton"/>
<!--Create an account-->
<waitForElementVisible selector="{{StorefrontCustomerSignInPopupFormSection.createAnAccount}}" stepKey="waitCreateAnAccountButton"/>
<click selector="{{StorefrontCustomerSignInPopupFormSection.createAnAccount}}" stepKey="clickOnCreateAnAccountButton"/>
<waitForPageLoad stepKey="waitForCreateAccountPageToLoad"/>
<!--Check the VAT Number field-->
<seeElement selector="{{StorefrontCustomerAddressSection.vatId}}" stepKey="assertVatIdField"/>
</test>
</tests>