Adding Cart Price Rule to Store Pickup not working
-
16-10-2019 - |
Question
I'm using Magento 1.7.0.2 and enabled the checkout store pickup function as described here: http://www.magentocommerce.com/boards/viewthread/12703/
It works fine so far. But I also need to apply a cart price rule to add 5% discount if a customer picks store pickup as the Shipping method.
Unfortunately that doesn't seem to work. The rule is not considered.
My cart price rule looks like:
If ALL conditions are TRUE: Shipping IS [pickup] Store Pickup
Action:
Percent of product price discount, Discount Amount: 5
If I select any other condition instead of pickup (like flatrate) it works as desired. But if I select pickup, nothing happens.
Any ideas why and how to fix this?
Solution
Change this file /app/code/core/Mage/Shipping/Model/Carrier/Pickup.php
.
Cause of this issue is when collectRates()
method executed, carrier method 'pickup' will be setted as shipping method ($method->setMethod('store')), but member function getAllowedMethods()
offers only 'pickup' method, and thats why we change 'store' to 'pickup'. By the way Shopping cart price rules uses getAllowedMethods()
, and frontend checkout uses collectRates()
, but both function picks different shipping method.
EDIT
Sorry, I was little confused while giving previous answer, but solution already given at this point. You should change function collectRates()
this line:
$method->setMethod('store');
to
$method->setMethod('pickup');