【发布时间】:2021-06-09 11:57:09
【问题描述】:
我们在 Magento CE2.4.1 上运行我们的网站。目前,结帐字段具有以下属性:
<input class="input-text" type="text" data-bind="
value: value,
valueUpdate: 'keyup',
hasFocus: focused,
attr: {
name: inputName,
placeholder: placeholder,
'aria-describedby': getDescriptionId(),
'aria-required': required,
'aria-invalid': error() ? true : 'false',
id: uid,
disabled: disabled
}" name="lastname" aria-required="true" aria-invalid="false" id="KR2W89N">
我想为每个字段添加 autocomplete 属性。像这样:
<input class="input-text" type="text" autocomplete="name" data-bind="[...]" name="lastname" aria-required="true" aria-invalid="false" id="KR2W89N">
我检查了以下文件,看看是否有办法实现这一点:
magento/module-checkout/view/frontend/web/template/shipping-address/form.html
magento/module-checkout/Block/CheckoutLayoutProcessor.php
至于form.html: 我想不出办法将特定的自动完成值作为每个字段的变量。
至于 CheckoutLayoutProcessor.php: 我在这个线程的帮助下创建了一个小模块:
How to auto fill the shipping address field in Checkout in Magento 2.2
我能够做到。 G。更改每个字段的 LABEL(仅作为测试)。但是,我找不到为每个结帐字段定义任何其他属性/选项的方法。
我是否正在查看正确的文件?任何帮助我都会非常感激。
我并不想自己自动填充这些字段。我只想添加属性,以便浏览器正确自动填充字段。目前,street.0的输入也会添加到street.1。
如果无法实现所需的解决方案:有没有办法只为 street.1 字段设置 autocomplete="off"?
谢谢! 亚历克斯
【问题讨论】:
标签: autocomplete magento2 checkout autofill street-address