I have the problem that the fields first name and last name of guest checkout are populated already with data which is not the clients data. How can I set that it is blank? Does anyone have an idea why the fields first name and last name are pre-filled on the first hand? Using Magento 2.3.3 Thank you very much already.
-
can you check my answer – Rakesh Donga Nov 3 '20 at 11:18
-
Hi Rakesh. Checking with our agency and let you know. Thank you much. – Ben Nov 3 '20 at 16:01
Try Below way:
app/code/Vendor/CheckoutStep/etc/frontend/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Checkout\Block\Checkout\LayoutProcessor">
<plugin name="Vendor_checkout_layout_processor_t" type="Vendor\CheckoutStep\Plugin\Block\LayoutProcessor" sortOrder="10"/>
</type>
</config>
app/code/Vendor/CheckoutStep/Plugin/Block/LayoutProcessor.php
<?php
namespace Vendor\CheckoutStep\Plugin\Block;
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']['firstname']['value'] = '';
$jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
['shippingAddress']['children']['shipping-address-fieldset']['children']['lastname']['value'] = '';
return $jsLayout;
}
}