Reputation: 1
I i have three shipping methods in my checkout page as follows.
what is want is fi customer select freeshipping or local pickup table rate cost need to invisible. when they select table rate again it should show the cost again. I used below code
function Ws_lk_hide_shipping ( $rates, $package ) {
// Only unset rates if free_shipping is available
if ( isset( $rates['free_shipping:12'] ) ) {
unset( $rates['table_rate:5'] );
} return $rates;}```
but above code hide the entire table rate line. so can not select it again.
Upvotes: 0
Views: 64
Reputation: 11
Instead of unsetting the $rates['table_rate:5'], try setting it to 0.00 or "Free Shipping", if it accepts string value, like below.
function Ws_lk_hide_shipping ( $rates, $package ) {
// Only unset rates if free_shipping is available
if ( isset( $rates['free_shipping:12'] ) ) {
$rates['table_rate:5'] = 0.00;
}
return $rates;
}
I'm having trouble understanding the actual issue, try above method if that solves the issue.
Upvotes: 0