Remove street address field and required attribute from shipping address

Magento Asked on December 6, 2021

I have a very custom use for Magento and I’m trying to remove street address from the checkout. Currently I have:

class LayoutProcessor {
 * @param MagentoCheckoutBlockCheckoutLayoutProcessor $subject
 * @param array $jsLayout
 * @return array
 public function afterProcess(
     MagentoCheckoutBlockCheckoutLayoutProcessor $subject,
     array  $jsLayout
 ) {
['shippingAddress']['children']['shipping-address-fieldset']['children']['street'] = [
    'component' => 'Magento_Ui/js/form/components/group',
    'required' => false,
    'dataScope' => 'shippingAddress.street',
    'provider' => 'checkoutProvider',
    'sortOrder' => 1005,
    'type' => 'group'

     return $jsLayout;

Unfortunately, while this seems to have removed the street address and stopped it from being required when entering shipping address, once I continue to the Review & Payment page and press “Place Order” it provides the following error, stopping me from proceeding:

Please check the shipping address information. street is a required field.

How can I stop this check and allow it to proceed?

This solution suggests that I can remove the required aspect of fields with jquery, but where would I put this js file and get magento to load it on the Review and Payment page?

2 Answers

Here is the solution for removing street address field

This solution is for removing City field. You can use it for removing Street address field as will.

Magento 2 : Remove the city field in checkout billing address

Answered by Sanaullah Ahmad on December 6, 2021

Hmm I'm I think there is no simple solution because the database will need a street. What you could do it create a plugin on GuestShippingInformationManagement (you will also need to do this for the non guest version). And add a fake 'street'. Or make the field hidden and add a default string in the street field?

Answered by Sanne on December 6, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP