Page 1 of 1

Checkout - click only when invoice and delivery address are different?

Posted: 27 Apr 2020, 13:54
by MAXambient
When I go to the checkout to enter my address as a guest, I can enter different information for the billing and delivery address.
I have to click that the data applies to both.
Can I configure the cart so that the billing and shipping address match automatically activated? And II only have to click if there is a different shipping address?

Re: Checkout - click only when invoice and delivery address are different?

Posted: 30 Apr 2020, 15:48
by Jan
Hi, as default, it is disabled for guest checkout. The "Delivery and billing addresses are the same" checkbox needs to be customized directly in the code - in view (can be overriden by template)

components\com_phocacart\views\checkout\tmpl\default_address.php

cca line 53

Code: Select all

echo '<label><input type="checkbox" id="phCheckoutBillingSameAsShipping" name="phcheckoutbsas" '.$this->t['dataaddressform']['bsch'].' > '.JText::_('COM_PHOCACART_DELIVERY_AND_BILLING_ADDRESSES_ARE_THE_SAME').'</label>';
instead of $this->t['dataaddressform']['bsch'] can be set 'checked="checked"'

But of course, if it should be different for guest checkout and logged in users, there needs to be some if condition like:

Code: Select all

if ($this->u->id > 0) {
   // logged in users
   echo '<label><input type="checkbox" id="phCheckoutBillingSameAsShipping" name="phcheckoutbsas" '.$this->t['dataaddressform']['bsch'].' > '.JText::_('COM_PHOCACART_DELIVERY_AND_BILLING_ADDRESSES_ARE_THE_SAME').'</label>';
} else {
   // guest users
   echo '<label><input type="checkbox" id="phCheckoutBillingSameAsShipping" name="phcheckoutbsas" checked="checked" > '.JText::_('COM_PHOCACART_DELIVERY_AND_BILLING_ADDRESSES_ARE_THE_SAME').'</label>';
}
etc. :idea:

Jan