Close

email optional field

gnik
8 years ago
#12083 Quote
Avatar
  • 41
Hi!

How to make email optional field?
iliyan.tanev
8 years ago
#12094 Quote
Avatar
  • Moderator
  • 347
Hi,

I don't think this is possible in nopCommerce. You will have to change much of the source code to achieve this because there are multiple parts that need the email to not be empty. 

Why do you need the email to be optional? 
Regards,
Iliyan Tanev
Nop-Templates Dev Team
gnik
8 years ago
#12096 Quote
Avatar
  • 41
The fact that we have bought the goods without paying for the site, and many customers do not have the email at all. So when they see Obligatory field with mail simply close the site.
iliyan.tanev
8 years ago
#12103 Quote
Avatar
  • Moderator
  • 347
Hi,

You can not remove the email, but you can hide it so to the customer it will appear it does not exist.

To do it you will need to:

Open the BillingAddress.cshtml view located at SevenSpikes.Nop.Plugins.RealOnePageCheckout/Views/RealOnePageCheckout, in there you will find a div that holds the label and the input of the email. In the input you will find an ng-reuqired directive. Remove it. Also in the value field you will see an angular expression looking like this:

{{vm.billingData.selectedBillingAddress.email}}


replace it with this

{{vm.billingData.selectedBillingAddress.email || '[email protected]'}}


This will just set a default value for the email to be [email protected].

In the div that wraps the email stuff set an inline styling like this:

style="display: none;"


This will hide the email div from the billing address form.

You should do the same for the shipping from the ShippingAddress.cshtml view.

Note: Keep in mind that this will remove the email option for all your customers, registered or guests!

Hope this helps!

Regards,
Iliyan Tanev
Nop-Templates Dev Team