F
F
Fqwd1232021-03-04 20:23:23
WooCommerce
Fqwd123, 2021-03-04 20:23:23

When reaching the free shipping limit, display other methods?

I will try to explain: now it works for me like this - if a client has exceeded the limit of $ 100 in the basket, he is given 2 delivery methods "Free Shipping" and "Local Pickup". But I need that besides this, one more delivery method is displayed - express delivery. In the settings of the wookumers, I found only such options:
60411762a08c3459622217.png
How can I add another one to these two methods? Thanks in advance for any help

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Fqwd123, 2021-03-05
@Fqwd123

It turned out that I have a plugin that disables all other delivery methods. I just turned it off and then manually set what methods I need if free shipping is available. Cut out the extra ones, and rejoice, here is the code:

add_filter( 'woocommerce_package_rates', 'bbloomer_unset_shipping_when_free_is_available_in_zone', 10, 2 );
   
function bbloomer_unset_shipping_when_free_is_available_in_zone( $rates, $package ) {
      
// Only unset rates if free_shipping is available
if ( isset( $rates['free_shipping:8'] ) ) {
     unset( $rates['flat_rate:1'] );
}     
     
return $rates;
  
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question