Skip to main content
Bounty Awarded with 50 reputation awarded by Allysin
Refactoring the solution for readability
Source Link
Tu Van
  • 8.4k
  • 2
  • 15
  • 26
  1. Edit your post to add the result of the following SQL query to get records that contain 'Your ':
  1. Run the following SQL query and add the result to your original question to let me know your total translation records at this time:
  1. For point 4 in the previous answer: "Which environment (local/dev(test)/staging/production) you are doing this task in?" I mean which environment you are working on, it can be local/dev(test)/staging site or production (live) site? Looks like you are doing this task on your production site, isn't it?
  2. Run the following command from your Magento root directory and put the result in your original question: grep -r "Your First Name" app vendor
  3. For the translation field labels in the delivery address and billing address, they use the same field, so you can'tcan't use the translation feature to change these labels. The solution for that is changing field labels. I'll write that solution soon.

I will post the solution for your need (different label for the delivery address and billing address) soon, maybe some hours later.

You need to changeYour requirements is changing the delivery address field labels and, the billing address field labels and they should be different labels (ie, the shipping field city label should different from the billing field city label). But
Because these field labels use the same text so you can't use the translation feature. To achieve your need, you should changing shipping and billing address field labels. Please take the following steps:

StepStep 1:
** Case 1: For Magento version >= 2.4.4 which do not have Amazon_Payment module:**

Check if your theme has app/design/frontend/<Vendor>/<theme>/Magento_Checkout/web/template/form/element/email.html file or not. If it does not exist, create a new one by copy the file vendor/magento/module-checkout/view/frontend/web/template/form/element/email.html to app/design/frontend/<Vendor>/<theme>/Magento_Checkout/web/template/form/element/email.html

Step 2:Case 2: For Magento version < 2.4.4 which have Amazon_Payment as build-in module or Magento version >= 2.4.4 installing Amazon_Payment as 3rd-party module:

Check if your theme has app/design/frontend/<Vendor>/<theme>/Amazon_Payment/web/template/form/element/email.html file or not.
If it does not exist, create a new one by copy the file vendor/amzn/amazon-pay-module/view/frontend/web/template/form/element/email.html to app/design/frontend/<Vendor>/<theme>/Amazon_Payment/web/template/form/element/email.html

Step 2. Open the file email.html mentioned in the above step to replace Email Address with Your Email Address.

Done
Done.

You need to create a new custom module for that. Assume you named the vendor name Vendor, and the module name Checkout (You can change the vendor name and module name). Take the following steps:

  1. Create app/design/frontend/Smartwave/porto_child/en_US/Amazon_Payment/web/template/form/elementapp/design/frontend/Smartwave/porto_child/Amazon_Payment/web/template/form/element folder.

  2. Copy vendor/amzn/amazon-pay-module/view/frontend/web/template/form/element/email.html to app/design/frontend/Smartwave/porto_child/en_US/Amazon_Payment/web/template/form/element/email.html.

  3. Open the file email.html mentioned in the above step to replace Email Address with Your Email Address.

  4. Re-deploy static content for frontend. To do that, run the following commands:

  1. Edit your post to add the result of the following SQL query:
  1. Run the following SQL query and add the result to your original question:
  1. For point 4 in the previous answer: "Which environment (local/dev(test)/staging/production) you are doing this task in?" I mean which environment you are working on, it can be local/dev(test)/staging site or production (live) site? Looks like you are doing this task on your production site, isn't it?
  2. Run the following command from your Magento root directory and put the result in your original question: grep -r "Your First Name" app vendor
  3. For the translation field labels in the delivery address and billing address, they use the same field, so you can't use the translation feature to change these labels. The solution for that is changing field labels. I'll write that solution soon.

I will post the solution for your need (different label for the delivery address and billing address) soon, maybe some hours later.

You need to change the delivery address field labels and the billing address field labels and they should be different labels. But these field labels use the same text so you can't use the translation feature. To achieve your need, take the following steps:

Step 1: Check if your theme has app/design/frontend/<Vendor>/<theme>/Magento_Checkout/web/template/form/element/email.html file or not. If it does not exist, create a new one by copy the file vendor/magento/module-checkout/view/frontend/web/template/form/element/email.html to app/design/frontend/<Vendor>/<theme>/Magento_Checkout/web/template/form/element/email.html

Step 2: Open the file email.html mentioned in above step to replace Email Address with Your Email Address.

Done.

You need to create a new custom module. Assume you named the vendor name Vendor, and the module name Checkout (You can change the vendor name and module name). Take the following steps:

  1. Create app/design/frontend/Smartwave/porto_child/en_US/Amazon_Payment/web/template/form/element folder.

  2. Copy vendor/amzn/amazon-pay-module/view/frontend/web/template/form/element/email.html to app/design/frontend/Smartwave/porto_child/en_US/Amazon_Payment/web/template/form/element/email.html.

  3. Open the file email.html mentioned in the above step to replace Email Address with Your Email Address.

  4. Re-deploy static content for frontend. To do that, run the following commands:

  1. Edit your post to add the result of the following SQL query to get records that contain 'Your ':
  1. Run the following SQL query and add the result to your original question to let me know your total translation records at this time:
  1. For point 4 in the previous answer: "Which environment (local/dev(test)/staging/production) you are doing this task in?" I mean which environment you are working on, it can be local/dev(test)/staging site or production (live) site? Looks like you are doing this task on your production site, isn't it?
  2. Run the following command from your Magento root directory and put the result in your original question: grep -r "Your First Name" app vendor
  3. For the translation field labels in the delivery address and billing address, they use the same field, so you can't use the translation feature to change these labels. The solution for that is changing field labels. I'll write that solution soon.

Your requirements is changing the delivery address field labels, the billing address field labels and they should be different labels (ie, the shipping field city label should different from the billing field city label).
Because these field labels use the same text so you can't use the translation feature, you should changing shipping and billing address field labels. Please take the following steps:

Step 1:
** Case 1: For Magento version >= 2.4.4 which do not have Amazon_Payment module:**

Check if your theme has app/design/frontend/<Vendor>/<theme>/Magento_Checkout/web/template/form/element/email.html file or not. If it does not exist, create a new one by copy the file vendor/magento/module-checkout/view/frontend/web/template/form/element/email.html to app/design/frontend/<Vendor>/<theme>/Magento_Checkout/web/template/form/element/email.html

Case 2: For Magento version < 2.4.4 which have Amazon_Payment as build-in module or Magento version >= 2.4.4 installing Amazon_Payment as 3rd-party module:

Check if your theme has app/design/frontend/<Vendor>/<theme>/Amazon_Payment/web/template/form/element/email.html file or not.
If it does not exist, create a new one by copy the file vendor/amzn/amazon-pay-module/view/frontend/web/template/form/element/email.html to app/design/frontend/<Vendor>/<theme>/Amazon_Payment/web/template/form/element/email.html

Step 2. Open the file email.html mentioned in the above step to replace Email Address with Your Email Address.
Done.

You need to create a new custom module for that. Assume you named the vendor name Vendor, and the module name Checkout (You can change the vendor name and module name). Take the following steps:

  1. Create app/design/frontend/Smartwave/porto_child/Amazon_Payment/web/template/form/element folder.

  2. Copy vendor/amzn/amazon-pay-module/view/frontend/web/template/form/element/email.html to app/design/frontend/Smartwave/porto_child/Amazon_Payment/web/template/form/element/email.html.

  3. Open the file email.html mentioned in the above step to replace Email Address with Your Email Address.

  4. Re-deploy static content for frontend. To do that, run the following commands:

Fix typos
Source Link
Tu Van
  • 8.4k
  • 2
  • 15
  • 26
<?php declare(strict_types=1); namespace Vendor\Checkout\Plugin; class ModifyCheckoutField { /** * Modify checkout field labels */ public function afterProcess( \Magento\Checkout\Block\Checkout\LayoutProcessor $subject, array $jsLayout ) { //Shipping Address if (isset( $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step'] ['children']['shippingAddress']['children']['shipping-address-fieldset']['children'] )) { $shippingAddressFieldset = &$jsLayout['components']['checkout']['children']['steps']['children'] ['shipping-step']['children'] ['shippingAddress']['children']['shipping-address-fieldset']['children']; $shippingAddressFieldset['firstname']['label'] = __('Recipient\'s First Name'); $shippingAddressFieldset['middlename']['label'] = __('Recipient\'s Middle Name/Initial'); $shippingAddressFieldset['lastname']['label'] = __('Recipient\'s Last Name'); $shippingAddressFieldset['suffix']['label'] = __('Recipient\'s Name Suffix'); $shippingAddressFieldset['company']['label'] = __('Recipient\'s Company'); $shippingAddressFieldset['street']['label'] = __('Recipient\'s Street Address'); $shippingAddressFieldset['street']['children'][0]['label'] = __('Recipient\'s Street Address: Line 1'); $shippingAddressFieldset['street']['children'][1]['label'] = __('Recipient\'s Street Address: Line 2'); $shippingAddressFieldset['country_id']['label'] = __('Recipient\'s City'Country'); $shippingAddressFieldset['region']['label'] = __('Recipient\'s State/Province'); $shippingAddressFieldset['region_id']['label'] = __('Recipient\'s State/Province'); $shippingAddressFieldset['city']['label'] = __('Recipient\'s City'); $shippingAddressFieldset['postcode']['label'] = __('Recipient\'s Zip/Postal Code'); $shippingAddressFieldset['telephone']['label'] = __('Recipient\'s Telephone Number'); $shippingAddressFieldset['fax']['label'] = __('Recipient\'s Fax'); $shippingAddressFieldset['vat_id']['label'] = __('Recipient\'s Tax/VAT Number'); } //Billing Address on payment method if (isset($jsLayout['components']['checkout']['children']['steps']['children']['billing-step'] ['children']['payment']['children']['payments-list']['children'])) { $paymentList = $jsLayout['components']['checkout']['children']['steps']['children']['billing-step'] ['children']['payment']['children']['payments-list']['children']; foreach ($paymentList as $key => $payment) { if (isset($payment['children']['form-fields']['children'])) { $paymentsListFormFields = &$jsLayout['components']['checkout']['children']['steps'] ['children']['billing-step']['children']['payment']['children']['payments-list'] ['children'][$key]['children']['form-fields']['children']; $paymentsListFormFields = $this->getModifiedFormFieldLabels($paymentsListFormFields); } } } //Billing Address on payment page if (isset($jsLayout['components']['checkout']['children']['steps']['children']['billing-step'] ['children']['payment']['children']['afterMethods']['children'])) { if (isset($jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children'] ['payment']['children']['afterMethods']['children']['billing-address-form']['children']['form-fields'] ['children'])) { $billingAddressFormFormFields = &$jsLayout['components']['checkout']['children']['steps']['children'] ['billing-step']['children']['payment']['children']['afterMethods'] ['children']['billing-address-form']['children']['form-fields']['children']; $billingAddressFormFormFields = $this->getModifiedFormFieldLabels($billingAddressFormFormFields); } } return $jsLayout; } /** * @param $billingFormFields * @return array */ private function getModifiedFormFieldLabels($billingFormFields): array { $billingFormFields['firstname']['label'] = __('Your First Name'); $billingFormFields['middlename']['label'] = __('Your Middle Name/Initial'); $billingFormFields['lastname']['label'] = __('Your Last Name'); $billingFormFields['suffix']['label'] = __('Your Name Suffix'); $billingFormFields['company']['label'] = __('Your Company'); $billingFormFields['street']['label'] = __('Your Street Address'); $billingFormFields['street']['children'][0]['label'] = __('Your Street Address: Line 1'); $billingFormFields['street']['children'][1]['label'] = __('Your Street Address: Line 2'); $billingFormFields['country_id']['label'] = __('Your City'Country'); $billingFormFields['region']['label'] = __('Your State/Province'); $billingFormFields['region_id']['label'] = __('Your State/Province'); $billingFormFields['city']['label'] = __('Your City'); $billingFormFields['postcode']['label'] = __('Your Zip/Postal Code'); $billingFormFields['telephone']['label'] = __('Your Telephone Number'); $billingFormFields['fax']['label'] = __('Your Fax'); $billingFormFields['vat_id']['label'] = __('Your Tax/VAT Number'); return $billingFormFields; } } 
<?php declare(strict_types=1); namespace Vendor\Checkout\Plugin; class ModifyCheckoutField { /** * Modify checkout field labels */ public function afterProcess( \Magento\Checkout\Block\Checkout\LayoutProcessor $subject, array $jsLayout ) { //Shipping Address if (isset( $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step'] ['children']['shippingAddress']['children']['shipping-address-fieldset']['children'] )) { $shippingAddressFieldset = &$jsLayout['components']['checkout']['children']['steps']['children'] ['shipping-step']['children'] ['shippingAddress']['children']['shipping-address-fieldset']['children']; $shippingAddressFieldset['firstname']['label'] = __('Recipient\'s First Name'); $shippingAddressFieldset['middlename']['label'] = __('Recipient\'s Middle Name/Initial'); $shippingAddressFieldset['lastname']['label'] = __('Recipient\'s Last Name'); $shippingAddressFieldset['suffix']['label'] = __('Recipient\'s Name Suffix'); $shippingAddressFieldset['company']['label'] = __('Recipient\'s Company'); $shippingAddressFieldset['street']['label'] = __('Recipient\'s Street Address'); $shippingAddressFieldset['street']['children'][0]['label'] = __('Recipient\'s Street Address: Line 1'); $shippingAddressFieldset['street']['children'][1]['label'] = __('Recipient\'s Street Address: Line 2'); $shippingAddressFieldset['country_id']['label'] = __('Recipient\'s City'); $shippingAddressFieldset['region']['label'] = __('Recipient\'s State/Province'); $shippingAddressFieldset['region_id']['label'] = __('Recipient\'s State/Province'); $shippingAddressFieldset['city']['label'] = __('Recipient\'s City'); $shippingAddressFieldset['postcode']['label'] = __('Recipient\'s Zip/Postal Code'); $shippingAddressFieldset['telephone']['label'] = __('Recipient\'s Telephone Number'); $shippingAddressFieldset['fax']['label'] = __('Recipient\'s Fax'); $shippingAddressFieldset['vat_id']['label'] = __('Recipient\'s Tax/VAT Number'); } //Billing Address on payment method if (isset($jsLayout['components']['checkout']['children']['steps']['children']['billing-step'] ['children']['payment']['children']['payments-list']['children'])) { $paymentList = $jsLayout['components']['checkout']['children']['steps']['children']['billing-step'] ['children']['payment']['children']['payments-list']['children']; foreach ($paymentList as $key => $payment) { if (isset($payment['children']['form-fields']['children'])) { $paymentsListFormFields = &$jsLayout['components']['checkout']['children']['steps'] ['children']['billing-step']['children']['payment']['children']['payments-list'] ['children'][$key]['children']['form-fields']['children']; $paymentsListFormFields = $this->getModifiedFormFieldLabels($paymentsListFormFields); } } } //Billing Address on payment page if (isset($jsLayout['components']['checkout']['children']['steps']['children']['billing-step'] ['children']['payment']['children']['afterMethods']['children'])) { if (isset($jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children'] ['payment']['children']['afterMethods']['children']['billing-address-form']['children']['form-fields'] ['children'])) { $billingAddressFormFormFields = &$jsLayout['components']['checkout']['children']['steps']['children'] ['billing-step']['children']['payment']['children']['afterMethods'] ['children']['billing-address-form']['children']['form-fields']['children']; $billingAddressFormFormFields = $this->getModifiedFormFieldLabels($billingAddressFormFormFields); } } return $jsLayout; } /** * @param $billingFormFields * @return array */ private function getModifiedFormFieldLabels($billingFormFields): array { $billingFormFields['firstname']['label'] = __('Your First Name'); $billingFormFields['middlename']['label'] = __('Your Middle Name/Initial'); $billingFormFields['lastname']['label'] = __('Your Last Name'); $billingFormFields['suffix']['label'] = __('Your Name Suffix'); $billingFormFields['company']['label'] = __('Your Company'); $billingFormFields['street']['label'] = __('Your Street Address'); $billingFormFields['street']['children'][0]['label'] = __('Your Street Address: Line 1'); $billingFormFields['street']['children'][1]['label'] = __('Your Street Address: Line 2'); $billingFormFields['country_id']['label'] = __('Your City'); $billingFormFields['region']['label'] = __('Your State/Province'); $billingFormFields['region_id']['label'] = __('Your State/Province'); $billingFormFields['city']['label'] = __('Your City'); $billingFormFields['postcode']['label'] = __('Your Zip/Postal Code'); $billingFormFields['telephone']['label'] = __('Your Telephone Number'); $billingFormFields['fax']['label'] = __('Your Fax'); $billingFormFields['vat_id']['label'] = __('Your Tax/VAT Number'); return $billingFormFields; } } 
<?php declare(strict_types=1); namespace Vendor\Checkout\Plugin; class ModifyCheckoutField { /** * Modify checkout field labels */ public function afterProcess( \Magento\Checkout\Block\Checkout\LayoutProcessor $subject, array $jsLayout ) { //Shipping Address if (isset( $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step'] ['children']['shippingAddress']['children']['shipping-address-fieldset']['children'] )) { $shippingAddressFieldset = &$jsLayout['components']['checkout']['children']['steps']['children'] ['shipping-step']['children'] ['shippingAddress']['children']['shipping-address-fieldset']['children']; $shippingAddressFieldset['firstname']['label'] = __('Recipient\'s First Name'); $shippingAddressFieldset['middlename']['label'] = __('Recipient\'s Middle Name/Initial'); $shippingAddressFieldset['lastname']['label'] = __('Recipient\'s Last Name'); $shippingAddressFieldset['suffix']['label'] = __('Recipient\'s Name Suffix'); $shippingAddressFieldset['company']['label'] = __('Recipient\'s Company'); $shippingAddressFieldset['street']['label'] = __('Recipient\'s Street Address'); $shippingAddressFieldset['street']['children'][0]['label'] = __('Recipient\'s Street Address: Line 1'); $shippingAddressFieldset['street']['children'][1]['label'] = __('Recipient\'s Street Address: Line 2'); $shippingAddressFieldset['country_id']['label'] = __('Recipient\'s Country'); $shippingAddressFieldset['region']['label'] = __('Recipient\'s State/Province'); $shippingAddressFieldset['region_id']['label'] = __('Recipient\'s State/Province'); $shippingAddressFieldset['city']['label'] = __('Recipient\'s City'); $shippingAddressFieldset['postcode']['label'] = __('Recipient\'s Zip/Postal Code'); $shippingAddressFieldset['telephone']['label'] = __('Recipient\'s Telephone Number'); $shippingAddressFieldset['fax']['label'] = __('Recipient\'s Fax'); $shippingAddressFieldset['vat_id']['label'] = __('Recipient\'s Tax/VAT Number'); } //Billing Address on payment method if (isset($jsLayout['components']['checkout']['children']['steps']['children']['billing-step'] ['children']['payment']['children']['payments-list']['children'])) { $paymentList = $jsLayout['components']['checkout']['children']['steps']['children']['billing-step'] ['children']['payment']['children']['payments-list']['children']; foreach ($paymentList as $key => $payment) { if (isset($payment['children']['form-fields']['children'])) { $paymentsListFormFields = &$jsLayout['components']['checkout']['children']['steps'] ['children']['billing-step']['children']['payment']['children']['payments-list'] ['children'][$key]['children']['form-fields']['children']; $paymentsListFormFields = $this->getModifiedFormFieldLabels($paymentsListFormFields); } } } //Billing Address on payment page if (isset($jsLayout['components']['checkout']['children']['steps']['children']['billing-step'] ['children']['payment']['children']['afterMethods']['children'])) { if (isset($jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children'] ['payment']['children']['afterMethods']['children']['billing-address-form']['children']['form-fields'] ['children'])) { $billingAddressFormFormFields = &$jsLayout['components']['checkout']['children']['steps']['children'] ['billing-step']['children']['payment']['children']['afterMethods'] ['children']['billing-address-form']['children']['form-fields']['children']; $billingAddressFormFormFields = $this->getModifiedFormFieldLabels($billingAddressFormFormFields); } } return $jsLayout; } /** * @param $billingFormFields * @return array */ private function getModifiedFormFieldLabels($billingFormFields): array { $billingFormFields['firstname']['label'] = __('Your First Name'); $billingFormFields['middlename']['label'] = __('Your Middle Name/Initial'); $billingFormFields['lastname']['label'] = __('Your Last Name'); $billingFormFields['suffix']['label'] = __('Your Name Suffix'); $billingFormFields['company']['label'] = __('Your Company'); $billingFormFields['street']['label'] = __('Your Street Address'); $billingFormFields['street']['children'][0]['label'] = __('Your Street Address: Line 1'); $billingFormFields['street']['children'][1]['label'] = __('Your Street Address: Line 2'); $billingFormFields['country_id']['label'] = __('Your Country'); $billingFormFields['region']['label'] = __('Your State/Province'); $billingFormFields['region_id']['label'] = __('Your State/Province'); $billingFormFields['city']['label'] = __('Your City'); $billingFormFields['postcode']['label'] = __('Your Zip/Postal Code'); $billingFormFields['telephone']['label'] = __('Your Telephone Number'); $billingFormFields['fax']['label'] = __('Your Fax'); $billingFormFields['vat_id']['label'] = __('Your Tax/VAT Number'); return $billingFormFields; } } 
Update solution based on the new information from the Original Poster
Source Link
Tu Van
  • 8.4k
  • 2
  • 15
  • 26

Update on November, 16th 2022
Based on your information (screenshot), please take the following steps to replace Email Address with Your Email Address:

  1. Create app/design/frontend/Smartwave/porto_child/en_US/Amazon_Payment/web/template/form/element folder.

  2. Copy vendor/amzn/amazon-pay-module/view/frontend/web/template/form/element/email.html to app/design/frontend/Smartwave/porto_child/en_US/Amazon_Payment/web/template/form/element/email.html.

  3. Open the file email.html mentioned in the above step to replace Email Address with Your Email Address.

  4. Re-deploy static content for frontend. To do that, run the following commands:

rm -rf var/view_preprocessed/pub/static/frontend rm -rf pub/static/frontend bin/magento setup:static-content:deploy -f --area frontend 

You are done, do not run other commands as they are not needed.

Update on November, 16th 2022
Based on your information (screenshot), please take the following steps to replace Email Address with Your Email Address:

  1. Create app/design/frontend/Smartwave/porto_child/en_US/Amazon_Payment/web/template/form/element folder.

  2. Copy vendor/amzn/amazon-pay-module/view/frontend/web/template/form/element/email.html to app/design/frontend/Smartwave/porto_child/en_US/Amazon_Payment/web/template/form/element/email.html.

  3. Open the file email.html mentioned in the above step to replace Email Address with Your Email Address.

  4. Re-deploy static content for frontend. To do that, run the following commands:

rm -rf var/view_preprocessed/pub/static/frontend rm -rf pub/static/frontend bin/magento setup:static-content:deploy -f --area frontend 

You are done, do not run other commands as they are not needed.

Update solution
Source Link
Tu Van
  • 8.4k
  • 2
  • 15
  • 26
Loading
Update solution
Source Link
Tu Van
  • 8.4k
  • 2
  • 15
  • 26
Loading
Update solution
Source Link
Tu Van
  • 8.4k
  • 2
  • 15
  • 26
Loading
Update solution
Source Link
Tu Van
  • 8.4k
  • 2
  • 15
  • 26
Loading
added 84 characters in body
Source Link
Tu Van
  • 8.4k
  • 2
  • 15
  • 26
Loading
Source Link
Tu Van
  • 8.4k
  • 2
  • 15
  • 26
Loading