cancel
Showing results for 
Search instead for 
Did you mean: 

Guest checkout without mail

SOLVED

Guest checkout without mail

Hey there, 

I am wondering how I can remove the address mail field for a checkout as a guest.

2 ACCEPTED SOLUTIONS

Accepted Solutions

Re: Guest checkout without mail

ok so I managed to hide the fields by adding /app/code/{Vendor}/{Module}/view/frontend/layout/checkout_index_index.xml :

 

<?xml version="1.0"?>

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="checkout.root">
            <arguments>
                <argument name="jsLayout" xsi:type="array">
                    <item name="components" xsi:type="array">
                        <item name="checkout" xsi:type="array">
                            <item name="children" xsi:type="array">
                                <item name="steps" xsi:type="array">
                                    <item name="children" xsi:type="array">
                                        <item name="shipping-step" xsi:type="array">
                                            <item name="children" xsi:type="array">
                                                <item name="shippingAddress" xsi:type="array">
                                                    <item name="children" xsi:type="array">
                                                        <item name="customer-email" xsi:type="array">
                                                            <item name="componentDisabled" xsi:type="boolean">true</item>
                                                        </item>
                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
    </body>
</page>

But I cannot validate the form, it seems that the mail address is still required.

View solution in original post

Re: Guest checkout without mail

I managed to extend the shipping.js file and add a custom address if customer is not logged in

 

if (!customer.isLoggedIn()) {
quote.guestEmail = 'mail@example.com';
}

 

View solution in original post

4 REPLIES 4

Re: Guest checkout without mail

Hello @anthonyalb38ed,

 

What you actually mean here mail Id or residential address for removal as if guest checkout?

 

 

If my answer is helpful, then hit kudos and accept as solution

 

Best regards
Madhuresan

Re: Guest checkout without mail

Hey @madhuresan_ramanan, thank you for answering back.

I am sorry if I was not clear.

What I would like to do is to remove/hide the login form in the checkout page, the one above the address form, so customers can order without bothering with providing email address.

 

https://imgur.com/a/OJU8kZW


(orders will be made and delivered at the actual store place so we don't need to ask for email)

Re: Guest checkout without mail

ok so I managed to hide the fields by adding /app/code/{Vendor}/{Module}/view/frontend/layout/checkout_index_index.xml :

 

<?xml version="1.0"?>

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="checkout.root">
            <arguments>
                <argument name="jsLayout" xsi:type="array">
                    <item name="components" xsi:type="array">
                        <item name="checkout" xsi:type="array">
                            <item name="children" xsi:type="array">
                                <item name="steps" xsi:type="array">
                                    <item name="children" xsi:type="array">
                                        <item name="shipping-step" xsi:type="array">
                                            <item name="children" xsi:type="array">
                                                <item name="shippingAddress" xsi:type="array">
                                                    <item name="children" xsi:type="array">
                                                        <item name="customer-email" xsi:type="array">
                                                            <item name="componentDisabled" xsi:type="boolean">true</item>
                                                        </item>
                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
    </body>
</page>

But I cannot validate the form, it seems that the mail address is still required.

Re: Guest checkout without mail

I managed to extend the shipping.js file and add a custom address if customer is not logged in

 

if (!customer.isLoggedIn()) {
quote.guestEmail = 'mail@example.com';
}