After making various conversion rate tweaks on the standard shipping method configurations I thought i’d put it all together in a post for others to use.
The Goals are:
- If free shipping is an available option don’t show any other options
- Auto select the available option – to remove an unnecessary click
(Please note in this example I’m using the IG_FlatShipping5 extension – but it works on the standard install too)
Find your available.phtml file in: app/design/frontend/default/default/template/checkout/onepage/shipping_method/or if using the IG_FlatShipping5 extension in: app/design/frontend/default/default/template/ig_flatshipping5
These are the code snippets to add:
Auto Select mod
getCode()=='freeshipping_freeshipping' && !$this->getAddress()->getShippingMethod()) {
$this->getAddress()->setShippingMethod($_rate->getCode());
} ?>
getCode()=='flatrate_flatrate' && !$this->getAddress()->getShippingMethod()) {
$this->getAddress()->setShippingMethod($_rate->getCode());
} ?>
getCode()=='flatrate2_flatrate2' && !$this->getAddress()->getShippingMethod()) {
$this->getAddress()->setShippingMethod($_rate->getCode());
} ?>
getCode()=='flatrate3_flatrate3' && !$this->getAddress()->getShippingMethod()) {
$this->getAddress()->setShippingMethod($_rate->getCode());
} ?>
getCode()=='flatrate4_flatrate4' && !$this->getAddress()->getShippingMethod()) {
$this->getAddress()->setShippingMethod($_rate->getCode());
} ?>
getCode()=='flatrate5_flatrate5' && !$this->getAddress()->getShippingMethod()) {
$this->getAddress()->setShippingMethod($_rate->getCode());
} ?>Obviously if you only using a couple of the flatrates delete the unnecessary ones. Here is the finished patched file:
getShippingRates())): ?>
__('Sorry, no quotes are available for this order at this time.') ?>
-
$_rates): ?>
- getCarrierName($code) ?>
-
-
Auto Select mod
getCode()=='freeshipping_freeshipping' && !$this->getAddress()->getShippingMethod()) {
$this->getAddress()->setShippingMethod($_rate->getCode());
} ?>
getCode()=='flatrate_flatrate' && !$this->getAddress()->getShippingMethod()) {
$this->getAddress()->setShippingMethod($_rate->getCode());
} ?>
getCode()=='flatrate2_flatrate2' && !$this->getAddress()->getShippingMethod()) {
$this->getAddress()->setShippingMethod($_rate->getCode());
} ?>
getCode()=='flatrate3_flatrate3' && !$this->getAddress()->getShippingMethod()) {
$this->getAddress()->setShippingMethod($_rate->getCode());
} ?>
getCode()=='flatrate4_flatrate4' && !$this->getAddress()->getShippingMethod()) {
$this->getAddress()->setShippingMethod($_rate->getCode());
} ?>
getCode()=='flatrate5_flatrate5' && !$this->getAddress()->getShippingMethod()) {
$this->getAddress()->setShippingMethod($_rate->getCode());
} ?>
- getErrorMessage()): ?> getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?>/>
So as an overview, the above modification when using the flat rate 5 extension with free shipping enabled will auto select the options and if free shipping is activated it will remove the unnecessary options.
Perfect solution! This is exactly what I was looking for!
Thank you, thank you thank you for your post!
No worries, I’m just glad my tinkering is useful to someone.