Oliver Williams
Oliver Williams

Reputation: 6344

magento determine if user has entered shipping information

I'm hoping someone can help me hook into this. The scenario is pretty straightforward:

A user has purchased a product and "views their cart". The URL looks like this:

http://shop-local.mysite.com/mystore/checkout/cart/

This shows no shipping and handling in the subtotals section below (though it does show it in the details section above which is annoying).

Now, the user "proceeds to checkout" and enters billing and shipping info. I have already tested, and once they have entered shipping info (2nd step on onepage checkout) and if they then return to view their cart, the shipping and tax info will show.

My question is, is there any way similar to ..->isLoggedIn() to determine if quote has shipping address yet? something like:

Mage::helper('quote/shipping')->getShipping()

or

Mage::helper('checkout')->quoteHasShipping()

obviously those aren't correct but something like that. Thanks!

Upvotes: 0

Views: 2808

Answers (2)

Mahmood Rehman
Mahmood Rehman

Reputation: 4331

I think you should try the default shipping address for that.Try like this :

Get customer default shipping information

$customerAddressId = Mage::getSingleton(‘customer/session’)->getCustomer()->getDefaultShipping();
if ($customerAddressId){
$address = Mage::getModel(‘customer/address’)->load($customerAddressId);
$address->getData();
}

Hope this help.

Upvotes: 2

Reena Parekh
Reena Parekh

Reputation: 941

Try this:

$shippingAddress = Mage::getModel('checkout/session')->getQuote()->getShippingAddress();

if(empty($shippingAddress)) {
//do your thing
}

Upvotes: 0

Related Questions