Magento Forum

Coupon does not recognize shipping address in cart
 
XjSv
Member
 
Avatar
Total Posts:  38
Joined:  2008-08-19
Ridgewood, NY
 

i have a shopping cart price rule that is ment to work depending on the shipping address.

when i try to apply the coupon something weird happens. i sign in my account which i have the address saved already i apply the code in the shopping cart and it says its invalid, i thought this is due to it not recognizing my address.

I know it dosent detect the state because when i put my state in the shipping estimator below the cart and click get quote THENNN i apply the coupon it work and also when i start the checkout process input the address then go back to cart and apply coupon it works

My address and state and all that its saved in my account previously. i tried making a new account but the same thing happens

It seems to me that the coupon module does not recognize the shipping address unlessssss you do the shipping quote or u go through the checkout steps and then go back to your cart and apply the coupon...but then you have to go though the checkout process again

i dont mind but im concerned about the customers

 
Magento Community Magento Community
Magento Community
Magento Community
 
XjSv
Member
 
Avatar
Total Posts:  38
Joined:  2008-08-19
Ridgewood, NY
 

can anybody take a look at this at least

 
Magento Community Magento Community
Magento Community
Magento Community
 
moiseq
Jr. Member
 
Total Posts:  19
Joined:  2009-03-27
 

I’m having the same problem.

In my case I have two stores representing two countries.

Since both have different tax values the subtotal condition is useless for a single rule, so I’ve tried to create 2 rules, one for each country using the base_subtotal condition toghether with the shipping destination.

Unfortunately in the shopping cart, where the coupon code is applied that value isn’t yet determined.

 
Magento Community Magento Community
Magento Community
Magento Community
 
XjSv
Member
 
Avatar
Total Posts:  38
Joined:  2008-08-19
Ridgewood, NY
 

yeah the only way it will work is if u start the checkout process and input ur address then click “view Cart” again then it will work. but its not good because i already have the address saved in my addressbook i shouldent have to checkout and thennn go back to the cart

 
Magento Community Magento Community
Magento Community
Magento Community
 
moiseq
Jr. Member
 
Total Posts:  19
Joined:  2009-03-27
 

OK, I modified the file “app/code/core/Mage/SalesRule/Model/Validator.php.

At the function process(Mage_Sales_Model_Quote_Item_Abstract $item) after

$quote $item->getQuote();
        if (
$item instanceof Mage_Sales_Model_Quote_Address_Item{
            $address 
$item->getAddress();
        
elseif ($quote->isVirtual()) {
            $address 
$quote->getBillingAddress();
        
else {
            $address 
$quote->getShippingAddress();
        
}

I added this line

$address->setCountryId($country_code)

the variable $country_code you must get it from somewhere, I get it from the storeview code.

Hope this helps!

 
Magento Community Magento Community
Magento Community
Magento Community
 
XjSv
Member
 
Avatar
Total Posts:  38
Joined:  2008-08-19
Ridgewood, NY
 

mmmm that sounds like it should work but its not based on countries its based on states/provinces what is the variable for that?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top