I'm editing app\design\frontend\Vendor\theme\Magento_Checkout\web\template\cart\shipping-estimation.html
which handles the shipping and tax estimation in shopping cart page.
Here is the code:
<form method="post" id="shipping-zip-form" class="shipping-zip-form">
<fieldset class="fieldset estimate">
<p class="field note" data-bind="text: isVirtual ? $t('Enter your billing address to get a tax estimate.') : $t('Enter your destination to get a shipping estimate.')"></p>
<!-- ko foreach: getRegion('address-fieldsets') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</fieldset>
from there, I know that it's being generated by knockout.js, so I searched around and found vendor\magento\module-ui\view\frontend\web\templates\form\element\input.html
<input class="input-text" type="text" data-bind="
value: value,
valueUpdate: 'keyup',
hasFocus: focused,
attr: {
name: inputName,
placeholder: placeholder,
'aria-describedby': noticeId,
id: uid,
disabled: disabled
}" />
and I also looked at this file
vendor\magento\module-ui\view\frontend\web\templates\form\field.html
which has this code
<label class="label" data-bind="attr: { for: element.uid }">
<!-- ko if: element.label -->
<span data-bind="text: element.label"></span>
<!-- /ko -->
</label>
So from those 2 files, I assume the placeholder must be inserted to the 'element', and then in vendor\magento\module-checkout\view\frontend\layout\checkout_cart_index.xml
, I tried this:
<item name="postcode" xsi:type="array">
<!-- post-code field has custom UI component -->
<item name="component" xsi:type="string">Magento_Ui/js/form/element/abstract</item>
<item name="dataScope" xsi:type="string">shippingAddress.postcode</item>
<item name="sortOrder" xsi:type="string">114</item>
<item name="provider" xsi:type="string">checkoutProvider</item>
<item name="placeholder" xsi:type="string">testPlaceholder</item>
</item>
and I added this in vendor\magento\module-ui\view\frontend\web\templates\form\field.html
provider: -<span data-bind="text: element.provider"></span>-
placeholder: -<span data-bind="text: element.placeholder"></span>-
which outputs:
provider: -checkoutProvider- placeholder: --
Placeholder doesn't show up in front end. So, any idea how to add the placeholder there? Thanks
data-bind="text: placeholder"
?