Jump to content

Remove customer address (not required for digital products)


Cpup

Recommended Posts

Hi,

Is there a way for the customer to only use just their name/username, email and password to register?

I sell digital music only and don't require a shipping address. I think some customers are reluctant to register and buy with their address required?

 

Link to comment
Share on other sites

This would require some modifications to the checkout pages (removing form fields, changing core code to not check for missing data, etc) -- but entirely do-able.

You should verify that the payment gateway does not require an address for any sort of credit card verification to match the card's billing address.

 

Link to comment
Share on other sites

Let's try what has been developed so far.

Several settings you need to make in the Store Settings:

Be sure there are no enabled shipping modules.
Disable initial shipping and tax estimates. Checked.
Allow delivery to non-invoice address. Unchecked.
Allow order Processing status to be skipped. Checked (maybe).
Allow physical orders even if no shipping options are available. Checked.

These settings seem to be irrelevant for a digital-only shopping basket, but, set these just to make sure.

There will be three edits to the Foundation skin, two in the template content.checkout.confirm.php and one in the template element.js_foot.php. If you are not using Foundation, we need to explore how to implement this in the skin you are using.

content.checkout.confirm.php

Line 180, from:
</address>
{if $TERMS_CONDITIONS}

To:
</address>
</div>
{if $TERMS_CONDITIONS}

Line 137, from:
   <h3>{$LANG.address.billing_address}</h3>
   {if !$ALLOW_DELIVERY_ADDRESS}{$LANG.address.ship_to_billing_only}{/if}

To:
<div class="hide" id="address_billing">
   <h3>{$LANG.address.billing_address}</h3>
   {if !$ALLOW_DELIVERY_ADDRESS}{$LANG.address.ship_to_billing_only}{/if}
element.js_foot.php

Line 13, from:
<script>{literal}$(document).foundation({equalizer:{equalize_on_stack:true}});$('.bxslider').bxSlider({auto:true,captions:true});$('.chzn-select').chosen({width:"100%",search_contains:true});{/literal}</script>

To:
<script>{literal}$("address").parent().remove();$(document).foundation({equalizer:{equalize_on_stack:true}});$('.bxslider').bxSlider({auto:true,captions:true});$('.chzn-select').chosen({width:"100%",search_contains:true});{/literal}</script>

The above wraps the billing address group of form elements in a div block similar to how the delivery address group is done. This allows for a javascript function to remove the groups of code -- not simply hide it which would still submit empty form fields, causing problems later on.

There is an edit to be made in the core code file /classes/cubecart.class.php. Fortunately, there is a nearby hook we can write a code snippet against, but let's try the edit first. (Be aware, upgrades will undo this edit - that's why hooks exist.)

/classes/cubecart.class.php

Near line 967, from:
        $GLOBALS['smarty']->assign('VAL_CUSTOMER_COMMENTS', isset($this->_basket['comments']) ? $this->_basket['comments'] : '');
        foreach ($GLOBALS['hooks']->load('class.cubecart.construct.confirm') as $hook) {
            include $hook;
        }

To:
        $GLOBALS['smarty']->assign('VAL_CUSTOMER_COMMENTS', isset($this->_basket['comments']) ? $this->_basket['comments'] : '');
$this->_basket['billing_address']['user_defined'] = true;
$this->_basket['delivery_address']['user_defined'] = true;
$this->_basket['customer'] = $_POST['user'];
        foreach ($GLOBALS['hooks']->load('class.cubecart.construct.confirm') as $hook) {
            include $hook;
        }

These three new lines are necessary to put required values in the basket that would have been done had there been anything from Billing that arrived in $_POST. The required basket values are the result of what would have been generated from validating the $_POST payload -- billing address fields, delivery address fields, etc. But, since none of that is now in $_POST, we need to fake a few things.

Within this validation section of the code, there are a few other things that may need to be dealt with: Still need to check T&C's are agreed to, validate reCaptcha, check email for valid format and prior use, password matching if the customer actually wants to create an account, valid phone number format, and creating a ghost customer in CubeCart_customers database table (important because currently, the billing and delivery name fields in CubeCart_order_summary are empty).

I still need to test this having taken an order through a simulated payment transaction.

Link to comment
Share on other sites

Hi @bsmither,

I've tried it on my test cubecart, but I can't register as a customer and getting the following:

The following errors were detected:

  • The verification code was incorrect. Please try again.

I registered via admin. It's now asking for a billing address before continuing with purchase.

Link to comment
Share on other sites

Yes, actually wanting to create an account is one of the things that needs further work. As well as a need to check that T&C's are agreed to, validate reCaptcha, etc, as mentioned earlier.

Can you test the sequence as a ghost customer? That is, do not try to create an account.

 

Link to comment
Share on other sites

I see that your OP specifies that you want your customers to be able to register (their option, I suppose).

That still leaves the obstacles to be solved are at the checkout stage. There is no requirement that the customer create an entry in the Addressbook.

But now, as a logged-in user, a different part of the checkout.confirm template is put in play. That needs to be sussed out.

 

Link to comment
Share on other sites

  • 4 months later...
On 11/9/2021 at 7:34 AM, Cpup said:

Hi @bsmitheris there an update on this topic?

I am hoping that in a new update of CubeCart in the future, there maybe a checkbox option in admin which allows digital downloads to be bought without having to fill out the billing/delivery address? Is this something that maybe possible @Al Brookbanks?

Most payment methods require a billing address as establishments are required by law to keep tax records. Selling without knowing your customer isn't widely considered to be acceptable in civilised countries so there are no plans to remove billing address from the checkout I'm afraid.

https://en.wikipedia.org/wiki/Know_your_customer 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...