Search code examples
magentogoogle-checkout

Free shipping on google checkout in magento


I am using magento 1.7.0.2 and Google Checkout. When want to use Flat rate, Free Shipping over $75 and 10% shipping between $68 - $75.

How i implement all three on my magento store.


Solution

  • I have searched more and got a solution, it's not a good idea to change core file but it's working. You can calculate price with charges before sending in google checkout. change core file of google checkout at /app/code/core/Mage/GoogleCheckout/Model/Api/Xml/checkout.php .

    Go to line 579 and make condition as you want. In my case the condition is as:

    *********************
    
    $subTotal = Mage::getModel('checkout/cart')->getQuote()->getSubtotal();
                if($subTotal <=68.50){
    
                $xml .= <<<EOT
                    <{$nodeName} name="{$title}">
                        <shipping-restrictions>
                            <allowed-areas>
                            {$allowedAreasXml}
                            </allowed-areas>
                        </shipping-restrictions>
                        <price currency="{$this->getCurrency()}">{$price}</price>
                    </{$nodeName}>
    EOT;
                }
    
                if(($subTotal > 68.50) && ($subTotal < 75)){
                $price = $subTotal*10/100;
                $xml .= <<<EOT
                    <{$nodeName} name="{$title}">
                        <shipping-restrictions>
                            <allowed-areas>
                            {$allowedAreasXml}
                            </allowed-areas>
                        </shipping-restrictions>
                        <price currency="{$this->getCurrency()}">{$price}</price>
                    </{$nodeName}>
    EOT;
                }
    
                if($subTotal >=75){
                $price = 0.00;
                $xml .= <<<EOT
                    <{$nodeName} name="{$title}">
                        <shipping-restrictions>
                            <allowed-areas>
                            {$allowedAreasXml}
                            </allowed-areas>
                        </shipping-restrictions>
                        <price currency="{$this->getCurrency()}">{$price}</price>
                    </{$nodeName}>
    EOT;
                }
            }
    

    Now refresh your store and make payment with google checkout.