News:

Looking for documentation? Take a look on our wiki

Main Menu

Guest checkout - shipping address (ST not as BT)

Started by Jumbo!, March 20, 2015, 07:53:04 AM

Previous topic - Next topic

Jumbo!

Shipping address is not getting saved properly in the cart during guest checkout. There are some small bugs in the cart controller and cart helper which only allow logged in user to save separate Shipping address. During guest checkout it always revert back STsameAsBT as true. Following changes are required to fix this issue.

Open Cart Controller: components/com_virtuemart/controllers/cart.php

Existing codes in line 137:
if(empty($cart->selected_shipto) or $cart->selected_shipto<1){
Replace above by:
if(!empty($cart->STsameAsBT) || (!$currentUser->guest && $cart->selected_shipto < 1)) {

Scroll down and remove/comment out the following codes between lines 157 to 159:
if(!empty($cart->STsameAsBT) or empty($cart->selected_shipto)){ //Guest
$cart->ST = $cart->BT;
}



Next open Cart Helper: components/com_virtuemart/helpers/cart.php

Existing codes in line 929:
if(!empty($this->STsameAsBT) or empty($this->selected_shipto)){ //Guest
Replace above by:
if(!empty($this->STsameAsBT) || (!$currentUser->guest && $this->selected_shipto < 1)) {

That's it.

In the existing codes when $selected_shipto is 0 or -1 it sets STsameAsBT as true. Which is correct for logged in users but for the guest. The above changes will fix the issue.