1

I believe I'm encountering a bug with the Fedex shipping calculation (might be problem with other carriers).

Steps to Replicate

  • Enable Fedex rates
  • Configure "Home Delivery" as the free method
  • Create a price rule to apply free shipping to a single sku (e.g. test-123)
  • Add sku test-123 to your cart
  • Add another item to your cart (sku somethingelse-456)

Expected Result

  • When shipping is calculated, sku test-123 should not be taken into account.
  • I.e. the shipping rate for a cart consisting of skus test-123 and somethingelse-456 should be the same as the shipping rate for a cart with sku somethingelse-456

Actual Result

  • The free shipping rule is not used and the Fedex rate includes the cost of shipping the test-123 item.

I have tested this on a clean CE 1.9.2.1 install with sample data.

For an example of how it should work, consider flat rate shipping. With a $5 flat rate per item, the cost to ship my 2 items would be $10, however because of the price rule, it is only $5.

Is this a bug? Has anyone else experienced this? What is the solution?


Here are some screen shots to further explain the issue:

ss1 ss2 ss3

2

yes, It's a bug.

you need to override this file

Mage_SalesRule_Model_Quote_Freeshipping

code your logic in collect function.

public function collect(Mage_Sales_Model_Quote_Address $address)
{
    parent::collect($address);
    $quote = $address->getQuote();
    $store = Mage::app()->getStore($quote->getStoreId());

    $address->setFreeShipping(0);
    $items = $this->_getAddressItems($address);
    if (!count($items)) {
        return $this;
    }
    $this->_calculator->init($store->getWebsiteId(), $quote->getCustomerGroupId(), $quote->getCouponCode());

    $isAllFree = true;
    foreach ($items as $item) {
        if ($item->getNoDiscount()) {
            $isAllFree = false;
            $item->setFreeShipping(false);
        } else {
            /**
             * Child item discount we calculate for parent
             */
            if ($item->getParentItemId()) {
                continue;
            }
            $this->_calculator->processFreeShipping($item);
            $isItemFree = (bool)$item->getFreeShipping();
            $isAllFree = $isAllFree && $isItemFree;
            if ($item->getHasChildren() && $item->isChildrenCalculated()) {
                foreach ($item->getChildren() as $child) {
                    $this->_calculator->processFreeShipping($child);
                    /**
                     * Parent free shipping we apply to all children
                     */
                    if ($isItemFree) {
                        $child->setFreeShipping($isItemFree);
                    }

                }
            }


            /*
             *  recalculate fedex price
             */

           // Your Logic here

            /*
             * 
             * end code
             */

        }
    }
    if ($isAllFree && !$address->getFreeShipping()) {
        $address->setFreeShipping(true);
    }
    return $this;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.