L
L
LastGeneral2020-03-11 10:04:50
HTML
LastGeneral, 2020-03-11 10:04:50

How to make a field optional in ocStore?

There are required fields in the checkout block:

<div class="form-group required">
        <label class="control-label" for="input-payment-address-1">{{ entry_address_1 }}</label>
        <input type="text" name="address_1" value="{{ address_1 }}" placeholder="{{ entry_address_1 }}" id="input-payment-address-1" class="form-control" />
</div>

How to make it so that the client could skip filling them?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
lazuren, 2020-03-18
@lazuren

Comment out these lines in payment_address.php, shipping_address.php and guest.php:

if ((utf8_strlen(trim($this->request->post['address_1'])) < 3) || (utf8_strlen(trim($this->request->post['address_1'])) > 128)) {
          $json['error']['address_1'] = $this->language->get('error_address_1');
        }

and remove the word required from so that the red asterisk next to the field disappears
<div class="form-group required">

A
azaza, 2020-03-11
@natojezlo

you need to pick the controller and the model,
but in general I advise you to install the simple checkout module, which can display any necessary fields and disable any
, it costs a penny

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question