2

I want to remove email field from checkout page for guest, I use OpenCart 3 with theme Journal 3. So what I can do?

I've tried to call out it from guest.php but still not work.

focus.style
  • 6,612
  • 4
  • 26
  • 38

2 Answers2

2

You can't just remove email field. A lot of system properties connected to email on checkout, although using journal3 makes more complicated extraction of email.

You can see what fields you can turn on / switch of in Journal Quick Checkout:

Journal > Skins > Checkout


UPDATED

To disable Email only for guests in Journal 3 Quick Checkout:

Go to /catalog/view/theme/journal3/template/journal3/checkout/register.twig

Find

{# customer email #}

<div class="form-group required account-email">
  <label class="control-label" for="input-email">{{ entry_email }}</label>
  <input v-model="order_data.email" type="text" name="email" value="" placeholder="{{ entry_email }}" id="input-email" class="form-control"/>
  <span class="text-danger" v-if="error && error.email" v-html="error.email"></span>
</div>

Adding a check, like for password v-if="account === 'register'". New code is

{# customer email #}

<div v-if="account === 'register'" class="form-group required account-email">
  <label class="control-label" for="input-email">{{ entry_email }}</label>
  <input v-model="order_data.email" type="text" name="email" value="" placeholder="{{ entry_email }}" id="input-email" class="form-control"/>
  <span class="text-danger" v-if="error && error.email" v-html="error.email"></span>
</div>

Now go to /catalog/controller/journal3/checkout.php and find

    // email
    if ((utf8_strlen(Arr::get($this->request->post, 'order_data.email')) > 96) || !filter_var(Arr::get($this->request->post, 'order_data.email'), FILTER_VALIDATE_EMAIL)) {
        $error['email'] = $this->language->get('error_email');
    } else if (($this->session->data['account'] === 'register') && $this->model_account_customer->getTotalCustomersByEmail(Arr::get($this->request->post, 'order_data.email'))) {
        $error['email'] = $this->language->get('error_exists');
    }

Replace with

    // email
    if ($this->session->data['account'] === 'register') {
        if ((utf8_strlen(Arr::get($this->request->post, 'order_data.email')) > 96) || !filter_var(Arr::get($this->request->post, 'order_data.email'), FILTER_VALIDATE_EMAIL)) {
            $error['email'] = $this->language->get('error_email');
        } else if (($this->session->data['account'] === 'register') && $this->model_account_customer->getTotalCustomersByEmail(Arr::get($this->request->post, 'order_data.email'))) {
            $error['email'] = $this->language->get('error_exists');
        }
    }
focus.style
  • 6,612
  • 4
  • 26
  • 38
0

Additional to the emntioned 3 steps you have to fix the sendmail funtion. One way is mentioned here in 2 more steps:

File: system/library/mail.php Change:

$this->to = $to;

To:

 if ($to != '') {$this->to = $to;} else { $this->to = 'web-and-seo@itech.bg';}

Change web-and-seo@itech.bg to an e-mail that you will receive the confirmation instead of the customer.

  1. Then remove the * from the mail field on checkout page

File: catalog/view/theme/journal3/template/journal3/checkout/register.twig Change:

<div class="form-group required account-email">

To:

<div class="form-group account-email">

Good luck.