Removing the shipping information fields

Hello everyone,

I'm new to LiteCart, and I'm in the process of setting up a digital file sales website. I was wondering if it's possible to simplify the checkout page by removing the shipping information fields (like address, phone number, etc.) and only retain the email, first name, and last name fields. Since I'm selling digital products, I don't need the physical shipping details.

Any guidance or suggestions on how to achieve this would be greatly appreciated!

Thank you in advance for your help.

Best regards,

Youss

Hello!  After removing the address1 and address2 fields from /includes/templates/default.catalog/views/box_checkout_customer.inc.php, it ask me again to input address! How to solve this?

@valdeo Removing the input fields is not enough. You should also comment out the check on the fields in file [b]includes/entities/ent_order.inc.php[/b]
Only address1 is required.
About line 562 you will find the validation of the input fields:


      try {
        if (empty($this->data['customer']['firstname'])) throw new Exception(language::translate('error_missing_firstname', 'You must enter a first name.'));
        if (empty($this->data['customer']['lastname'])) throw new Exception(language::translate('error_missing_lastname', 'You must enter a last name.'));
        //if (empty($this->data['customer']['address1'])) throw new Exception(language::translate('error_missing_address1', 'You must enter an address.'));
        if (empty($this->data['customer']['city'])) throw new Exception(language::translate('error_missing_city', 'You must enter a city.'));
        if (empty($this->data['customer']['country_code'])) throw new Exception(language::translate('error_missing_country', 'You must select a country.'));```
But better not modify this file! Use the vmod below (attached)

@ jackmaessen
Many thanks for your valuable help!

One more question if you don't mind.  How to make the field for Different Shipping Address is always fully displayed?

Works perfect! Thanks again!

After removing the  post code field, it  throws message: you must enter the post code. But validation of this field in file includes/entities/ent_order.inc.php seems quite different from the others.I've tried to comment it out, but throws some error. Any help will be appreciated!

which postal code field did you remove: from Customer Details or Different Shipping Address?
And what is exactly the error?

Postal code field  removed from Customer Details. 
After comment in includes/entities/ent_order.inc.php of:

//if (reference::country($this->data['customer']['country_code'])->postcode_format) {
          if (!empty($this->data['customer']['postcode'])) {
            if (!preg_match('#'. reference::country($this->data['customer']['country_code'])->postcode_format .'#i', $this->data['customer']['postcode'])) {
              throw new Exception(language::translate('error_invalid_postcode_format', 'Invalid postcode format'));
            }
          } else {
            throw new Exception(language::translate('error_missing_postcode', 'You must enter a postcode'));
          }
        }

Throws:  Fatal error: syntax error, unexpected 'catch' (T_CATCH), expecting function (T_FUNCTION) or const (T_CONST) in ~/vmods/.cache/includes-entities-ent_order.inc.php (Line 610)

Haven't tested it but try this:


     if (!empty($this->data['customer']['postcode'])) {
          if (!preg_match('#'. reference::country($this->data['customer']['country_code'])->postcode_format .'#i', $this->data['customer']['postcode'])) {
              throw new Exception(language::translate('error_invalid_postcode_format', 'Invalid postcode format'));
          }
     } else {
          throw new Exception(language::translate('error_missing_postcode', 'You must enter a postcode'));
     }
}*/```
or this:
```if (reference::country($this->data['customer']['country_code'])->postcode_format) {
      if (!empty($this->data['customer']['postcode'])) {
          if (!preg_match('#'. reference::country($this->data['customer']['country_code'])->postcode_format .'#i', $this->data['customer']['postcode'])) {
              //throw new Exception(language::translate('error_invalid_postcode_format', 'Invalid postcode format'));
          }
      } else {
           // throw new Exception(language::translate('error_missing_postcode', 'You must enter a postcode'));
      }
}```

To deactivate the postal code you just have to go to country and then in code format and leave it empty and that's it.

Thank you all! I will try your suggestions.

Hello!  The postal code warning is solved. Thanks!
 But after removing the country and zone fields in Different shipping address,
 I get this in order print and packing list:

Warning: Invalid country code () in ~/includes/references/ref_country.inc.php (Line 12)

Any help will be appreciated!

Comment it out:


        //trigger_error('Invalid country code ('. $country_code .')', E_USER_WARNING);
      }```

@jackmaessen
Thanks!
I did it, but unfortunately this doesn't help!?

This thread has been closed due to long inactivity. Posting to it is not possible.
View code on GitHub