我想在magento 2结帐页面上的街道地址字段上添加工具提示。 我尝试将其添加到:vendor \ magento \ module-checkout \ view \ frontend \ layout \ checkout_index_index.xml
<item name="street" xsi:type="array">
<item name="config" xsi:type="array">
<item name="tooltip" xsi:type="array">
<item name="description" xsi:type="string" translate="true">For delivery address verification.</item>
</item>
</item>
</item>
答案 0 :(得分:0)
您可以创建一个after plugin
来向街道字段添加工具提示,您需要注入Checkout LayoutProcessor
Class LayoutProcessor
{
/**
* @param \Magento\Checkout\Block\Checkout\LayoutProcessor $subject
* @param array $jsLayout
* @return array
*/
public function afterProcess(
\Magento\Checkout\Block\Checkout\LayoutProcessor $subject,
array $jsLayout
) {
$jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
['shippingAddress']['children']['shipping-address-fieldset']['children']['street']['children'][0]['tooltip']['description'] = "ToolTip 1";
$jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
['shippingAddress']['children']['shipping-address-fieldset']['children']['street']['children'][1]['tooltip']['description'] = "ToolTip 2";
return $jsLayout;
}
}
请参阅此POST