I have some configurable products that needs no shipping so I want the checkout to hide the shipping information (second step) and shipping method (third step): when the customer lands on checkout page, he can set his billing information and when he clicks on the continue button he needs to go straight to the payment step.
I've managed to hide the shipping method step by using the observer as explained in this thread and this part works as expected: the customer lands on the checkout page, fills in billing information, clicks on continue and (because "ship to this address" is flagged) he goes straight to the payment section, leaving out the shipping method.
Since I don't need the shipping method step, I've hidden it by rewriting the onepage_shipping_method:
- I've added the rewrite in my config.xml
<blocks>
<checkout>
<rewrite>
<onepage_shipping_method>Vendor_Module_Block_Onepage_Shipping_Method</onepage_shipping_method>
</rewrite>
</checkout>
</blocks>
- I've set the step to
show = false
in the block:
class Vendor_Module_Block_Onepage_Shipping_Method extends Mage_Checkout_Block_Onepage_Shipping_Method {
public function isShow() {return false;}
}
This works: now the customer not only skips the shipping method step, but this step is also hidden so the customer doesn't see. That's perferct.
Now I need to hide the second step (shipping information). In order to do this I need to first hide the the radio buttons (ship to this/different address) in the billing step, then I need to hide the second step (the shipping information step).
To hide the radio buttons I simply rewrote the billing block, setting the canShip method to false:
- config.xml
<blocks>
<checkout>
<rewrite>
<onepage_billing>Vendor_Module_Block_Onepage_Billing</onepage_billing> <onepage_shipping_method>Vendor_Module_Block_Onepage_Shipping_Method</onepage_shipping_method>
</rewrite>
</checkout>
</blocks>
- my block
class Vendor_Module_Block_Onepage_Billing extends Mage_Checkout_Block_Onepage_Billing {
public function canShip() {return false;}
}
This works: when I land on the checkout page, I see the billing step but no radio button are shown and when I click on continue I go straight to the payment step.
However, the shipping information step is still visible. If I try and hide it the same way I did for the shipping method step, the continue button stops working. What I mean is:
- I add the block rewrite in my config.xml
<blocks>
<checkout>
<rewrite>
<onepage_billing>Vendor_Module_Block_Onepage_Billing</onepage_billing>
<onepage_shipping>Vendor_Module_Block_Onepage_Shipping</onepage_shipping>
<onepage_shipping_method>Vendor_Module_Block_Onepage_Shipping_Method</onepage_shipping_method>
</rewrite>
</checkout>
</blocks>
- I create the block with the isShow method set to false:
class Vendor_Module_Block_Onepage_Shipping extends Mage_Checkout_Block_Onepage_Shipping {
public function isShow() {return false;}
}
This doesn't work: when I land to the checkout page, fill in the billing information and click on continue, the continue button does nothing: for a single moment the loading icon appears but then nothing happens, the checkout doesn't go to the payment section
So my question is: how can I hide the shipping information step from checkout?