Shipping class priority & hide normal delivery (free shipping reached)
-
Good morning, I have a question about shipping. At the moment I have some products that have a free shipping class and some that have a paid shipping class. I have 3 shipping solutions in parrallel: 1 by post (Bpost), 1 with Mondial Relay and 1 free post delivery for a minimum purchase amount. I have 2 questions: - When I have 2 products with 2 different shipping classes in my cart (1 free shipping class and the other with paid shipping class), I would like to be able to apply automatically the free shipping class first so with this no shipping costs will be calculated. - When the minimum basket is reached for free delivery, I would like to hide with php code the "by post Bpost" option only, not hidding the Mondial Relay option as I want to let the choice to the client even it's free to select by post or by Mondial relay. I found this php code but it hides all the options even Mondial Relay, how can I hide only "by post Bpost"? // Hide all shipping rates when free shipping is available, but keep "Local pickup" method add_filter( 'woocommerce_package_rates', 'wpsh_hide_if_free', 100 ); function wpsh_hide_if_free($rates) { $free = $local = array(); foreach ( $rates as $rate_id => $rate ) { if ( 'free_shipping' === $rate->method_id ) { $free[ $rate_id ] = $rate; } elseif ( 'local_pickup' === $rate->method_id ) { $local[ $rate_id ] = $rate; } } return ! empty( $free ) ? array_merge( $free, $local ) : $rates; }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Shipping class priority & hide normal delivery (free shipping reached)’ is closed to new replies.