问题
I am trying to hide other shipping methods if the shipping price is 0.00
without using or creating a custom module.
The desired algorithm is:
- If shipping price is 0.00 hide all other shipping methods
This is the Abstract.php
I've tried:
<?php
public function getShippingRates()
{
$groups = parent::getShippingRates();
$free = array();
foreach($groups as $code => $_rates)
{
foreach($_rates as $_rate)
{
if (!$_rate->getPrice() > 0)
{
$free[$code] = $_rates;
}
}
}
if (!empty($free))
{
return $this->_rates = $free;
}
return $groups;
}
来源:https://stackoverflow.com/questions/31875604/magento-hide-other-shipping-methods-if-shipping-price-is-0-00-without-module