Skip to content

Commit 7ce571c

Browse files
ENGCOM-8617: Add missing "VAT Number" field to customer registration page #31321
2 parents 3fef6d1 + 37b8393 commit 7ce571c

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed

app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerDashboardAccountInformationSection/StorefrontCustomerAddressSection.xml

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<element name="stateProvinceFill" type="input" selector="#region"/>
2020
<element name="zip" type="input" selector="#zip"/>
2121
<element name="country" type="select" selector="#country"/>
22+
<element name="vatId" type="input" selector="#vat_id"/>
2223
<element name="saveAddress" type="button" selector="[data-action='save-address']" timeout="30"/>
2324
</section>
2425
</sections>

app/code/Magento/Customer/view/frontend/templates/form/register.phtml

+17
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,23 @@ $formData = $block->getFormData();
131131
</div>
132132
</div>
133133

134+
<?php if ($addressHelper->isVatAttributeVisible()): ?>
135+
<?php $_vatidValidationClass = $addressHelper->getAttributeValidationClass('vat_id'); ?>
136+
<div class="field taxvat">
137+
<label class="label" for="vat_id">
138+
<span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('vat_id') ?></span>
139+
</label>
140+
<div class="control">
141+
<input type="text"
142+
name="vat_id"
143+
value="<?= $escaper->escapeHtmlAttr($formData->getVatId()) ?>"
144+
title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('vat_id') ?>"
145+
class="input-text <?= $escaper->escapeHtmlAttr($_vatidValidationClass) ?>"
146+
id="vat_id">
147+
</div>
148+
</div>
149+
<?php endif; ?>
150+
134151
<div class="field country required">
135152
<label for="country" class="label">
136153
<span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('country_id') ?></span>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StoreFrontCheckVatIdAtAccountCreateWithMultishipmentTest">
12+
<annotations>
13+
<features value="Multishipment"/>
14+
<stories value="Checking vat id field at account create page with 'Check Out with Multiple Addresses'"/>
15+
<title value="Checking vat id field at account create page with 'Check Out with Multiple Addresses'"/>
16+
<description value="'VAT Number' field should be available at create account page if 'Show VAT Number on Storefront' is Yes"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MC-40397"/>
19+
<group value="Multishipment"/>
20+
</annotations>
21+
<before>
22+
<magentoCLI command="config:set customer/create_account/vat_frontend_visibility 1" stepKey="showVatNumberOnStorefrontYes"/>
23+
<createData entity="SimpleSubCategory" stepKey="category"/>
24+
<createData entity="SimpleProduct" stepKey="product">
25+
<requiredEntity createDataKey="category"/>
26+
</createData>
27+
</before>
28+
<after>
29+
<magentoCLI command="config:set customer/create_account/vat_frontend_visibility 0" stepKey="showVatNumberOnStorefrontNo"/>
30+
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCacheAfter">
31+
<argument name="tags" value="config"/>
32+
</actionGroup>
33+
<deleteData createDataKey="category" stepKey="deleteCategory"/>
34+
<deleteData createDataKey="product" stepKey="deleteproduct"/>
35+
</after>
36+
<!-- Add product to the cart -->
37+
<amOnPage url="$$product.name$$.html" stepKey="goToProductPage"/>
38+
<actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addProductToCart">
39+
<argument name="productName" value="$$product.name$$"/>
40+
</actionGroup>
41+
<!-- Check Out with Multiple Addresses -->
42+
<actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openCart"/>
43+
<waitForElementVisible selector="{{MultishippingSection.shippingMultipleCheckout}}" stepKey="waitMultipleAddressShippingButton"/>
44+
<click selector="{{MultishippingSection.shippingMultipleCheckout}}" stepKey="clickToMultipleAddressShippingButton"/>
45+
<!--Create an account-->
46+
<waitForElementVisible selector="{{StorefrontCustomerSignInPopupFormSection.createAnAccount}}" stepKey="waitCreateAnAccountButton"/>
47+
<click selector="{{StorefrontCustomerSignInPopupFormSection.createAnAccount}}" stepKey="clickOnCreateAnAccountButton"/>
48+
<waitForPageLoad stepKey="waitForCreateAccountPageToLoad"/>
49+
<!--Check the VAT Number field-->
50+
<seeElement selector="{{StorefrontCustomerAddressSection.vatId}}" stepKey="assertVatIdField"/>
51+
</test>
52+
</tests>

0 commit comments

Comments
 (0)