Jump to content

Remove Delivery and Invoice Address fields in the Guest Checkout (PS 1.6)


nogs

Recommended Posts

I would like to know how I can configure PS 1.6 so that when my customers check out using the default PS "guest checkout" system, they have to enter no other information other than their first and last name, email and mobile number.

 

To clarify I don't want them to even see "social title", "date of birth", "address", "zip/postal code", "city", "country", "state" or any of these fields under the "Invoice Address".

 

Thanks in advance.

 

Link to comment
Share on other sites

Before we begin, I would like to inform if the following variables is associated with customer object (only certain variables mentioned here):

id_gender (social title), firstname, lastname, email, birthday (date of birth)

 

Whereas "address", "zip/postal code", "city", "country", "state", "phone", "mobile phone" are variables associated with address object.

 

Since you only need : first and last name, email and mobile number, then you only need to activate one country (your country of course).

 

Conditions :

Prestashop v.1.6.1.0

Order process type > One-page Checkout

Guest Checkout > Enabled

 

1st, change the address format, go to : B.O > Localization > Countries
Pick your country and change the address format, click the "Edit" menu available on the right.
Scroll down to the "Address format" field option
Remove all default values available on "Address format" but keep the "phone_mobile"
Set all of the following configuration options to "NO" : "Does it need Zip/postal code?", "Contains states", "Do you need a tax identification number?"
Set the "Zip/postal code format" empty/blank
Save the changes.

 

2nd, modify theme file order-opc-new-account.tpl to remove (hide) the unnecessary fields.

Add new class "hide" into the corresponding div tag which wrapping the unecessary fields.

For example if we want to hide "Social title", then find <label>{l s='Social title'}</label> and add new class "hide" to the div wrapper (it's above the label html tag).

<div class="hide required clearfix gender-line">
      <label>{l s='Social title'}</label>
      {* Rest of smarty code here *}
</div>

Do the same procedure for the unnecessary fields.
Then try to place a test order on your shop and checkout with "Instant Checkout" / "Guest Checkout", the unnecessary fields should be hidden right now.

 

.

 

... Next 3rd, create dummy address by defining default field value

Edited by gonebdg - webindoshop.com (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...

Ok let's continue.

3rd, modify theme file order-opc-new-account.tpl to create dummy address by defining default field value

If the 1st step already done correctly, then only: addrees, city, country, and alias are the required fields.

Add following smarty code on the top of the file :

{assign var=default_address value='My address'}
{assign var=default_city value='My city'}
{assign var=default_country value='DEFAULT_COUNTRY_ID'}
{assign var=default_alias value='My dummy address'}

Attention! replace DEFAULT_COUNTRY_ID with your default country ID

Feel free to change the value for the others dummy var as you wish

 

Then for each corresponding HTML input, put the dummy smarty variable as the input value

Below are an example about how to defining default value for field address1

{* commenting the original smarty code OR you might remove it completely
<input type="text" class="text form-control validate" name="address1" id="address1" data-validate="isAddress" value="{if isset($guestInformations) && isset($guestInformations.address1) && isset($guestInformations) && isset($guestInformations.address1) && $guestInformations.address1}{$guestInformations.address1}{/if}" />
*}
<input type="text" class="text form-control validate" name="address1" id="address1" data-validate="isAddress" value="{$default_address}" />

Do the same procedure for city and alias

 

Except for country field input, we need to remove the original field (HTML select) and create a hidden input field

{* commenting the original smarty code OR you might remove it completely
<select name="id_country" id="id_country" class="form-control">
   {foreach from=$countries item=v}
      <option value="{$v.id_country}"{if (isset($guestInformations) && isset($guestInformations.id_country) && $guestInformations.id_country == $v.id_country) || (!isset($guestInformations) && $sl_country == $v.id_country)} selected="selected"{/if}>{$v.name|escape:'html':'UTF-8'}</option>
   {/foreach}
</select>
*}
<input type="hidden" name="id_country" id="id_country" value="{$default_country}" />

That's it, now all required fields for address have default value, so customers doesn't have to fill an address, however if the 2nd step above already done correctly then there is no address fields displayed on the form.

  • Like 2
Link to comment
Share on other sites

What about for version 1.6.1.1?

 

PrestaShop seems to crack when it comes to handling downloadable products.

 

The money spent on this article -> http://www.matthewwoodward.co.uk/tutorials/sell-digital-products-online-prestashop/ would have been better spent making sure it was actually suitable for this purpose.

 

Once I get the payment gateway figured out, I might switch to WooCommerce. This is too much work.

Link to comment
Share on other sites

I was quite stunned when I realized that the Title and DOB fields were, unless I am mistaken, HARDCODED into the Registration and Guest checkout forms.

I looked for an "Age Restriction" module to disable, because, thats the ONLY reason a shopping cart would EVER need to ask a customers birthday. Having to input such personal info for no customer benifit, just puts customers off.

Alss, No Age Restriction module could be found..

So in v1.6.1.1, is there still SIMPLE no way to disable these fields from the backend?

 

Also, for Australia at least, no one bothers with Salutations anymore. Need to easily turn off the DOB and Title fields..

 

So I set about changing the code, and adding "hide to the clas.

Made the changes to order-opc-new-account.tpl, then order-opc-new-account-advanced.tpl then even changed the only other instance of "{l s='Social title'}" that I could find in identity.tpl.

Deleted the Cache folder  each time, and cleared local cache. but to no avail, the "Title field still shows.

Maybe a hook somewhere?

Edited by remoteONE (see edit history)
Link to comment
Share on other sites

  • 1 month later...

Hello

I am using version 1.6.1.1 and have tried all the solutions suggested above. I cannot get this to work.

 

I still see all the fields and the guest checkout is still asked for a delivery address.

 

Can anyone advise me how to remove the required labels from the form during the checkout process and to stop the delivery details from appearing?

 

Thanks!

Link to comment
Share on other sites

  • 2 weeks later...

Before we begin, I would like to inform if the following variables is associated with customer object (only certain variables mentioned here):

id_gender (social title), firstname, lastname, email, birthday (date of birth)

 

Whereas "address", "zip/postal code", "city", "country", "state", "phone", "mobile phone" are variables associated with address object.

 

Since you only need : first and last name, email and mobile number, then you only need to activate one country (your country of course).

 

Conditions :

Prestashop v.1.6.1.0

Order process type > One-page Checkout

Guest Checkout > Enabled

 

1st, change the address format, go to : B.O > Localization > Countries

Pick your country and change the address format, click the "Edit" menu available on the right.

Scroll down to the "Address format" field option

Remove all default values available on "Address format" but keep the "phone_mobile"

Set all of the following configuration options to "NO" : "Does it need Zip/postal code?", "Contains states", "Do you need a tax identification number?"

Set the "Zip/postal code format" empty/blank

Save the changes.

 

2nd, modify theme file order-opc-new-account.tpl to remove (hide) the unnecessary fields.

Add new class "hide" into the corresponding div tag which wrapping the unecessary fields.

For example if we want to hide "Social title", then find <label>{l s='Social title'}</label> and add new class "hide" to the div wrapper (it's above the label html tag).

<div class="hide required clearfix gender-line">
      <label>{l s='Social title'}</label>
      {* Rest of smarty code here *}
</div>

Do the same procedure for the unnecessary fields.

Then try to place a test order on your shop and checkout with "Instant Checkout" / "Guest Checkout", the unnecessary fields should be hidden right now.

 

.

 

... Next 3rd, create dummy address by defining default field value

 

I have question to your solution- I wanted to disable few fields but mainly "country". Problem is that when I disable it, postal code doesn't work- It validates but the field is "red".

It's something to do with hiding the country. Any ideas? 

(prestashop 1.6.1

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 months later...

Hi , this is very interesting for me but i'm using PrestaShop™ 1.5.6.2 , i was searching more than 1 week , tested many ways but i still get errors ! Can you help me please with PS 1.5.6.2 I

in guest checkout :

First Name :
Last Name :
Email :
Comment :


Only , adress and all other option will be disabled !!

 

Thanks in advance

Edited by chahidkhan (see edit history)
Link to comment
Share on other sites

  • 2 months later...
  • 6 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...