1

イベント「controller_predispatch_checkout_cart_index」を使ってみて、この機能を使いました。ログインした後、ページ/チェックアウト/カートに直接移動すると機能しませんが、ページをリロードすると機能します...どうしたのですか???

    const FREE_CODE = 'freeshipping_freeshipping';

    public function predispatchCart($observer)
    {
        $quote      = Mage::getSingleton('checkout/cart')->getQuote();



        if(! $quote->getShippingAddress()->getShippingMethod())
        {
            $quote->getShippingAddress()
                    ->setShippingMethod(self::FREE_CODE);
                    //->save();
            return true;
        }
   }
}
4

0 に答える 0