• Resolved davidsimon14

    (@davidsimon14)


    Hey guys,

    I’m pretty new to woocommerce and code snippets, I tried to write a small code to hide a specific shipping method when over 150€, but it doesn’t do anything.
    29 is the ID that I got from the form (input value is mondial_relay_point_relais:29).

    add_filter('woocommerce_package_rates',function( $rates ){
    	$order_total = WC()->cart->get_subtotal();
      
    	  if( $order_total > 150 ) {
    		unset( $rates[29] );
    	  }
      	return $rates;
    	}		  
    );

    I set up the plugin and activated the php code in the public interface. I don’t know if I need to specify somewhere where the code needs to run.

    Any help would be gladly accepted.

    Thanks!

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    Hi @davidsimon14,

    I can’t see any issues in your code, but I am not very familiar with WooCommerce. It’s possible that the way to hide shipping methods has changed in newer versions of WooCommerce.

    I’d recommend asking this question in a forum specific to WooCommerce or a developer with WooCommerce experience. Sorry I can’t be of more help!

    Thread Starter davidsimon14

    (@davidsimon14)

    Hi Shea,

    Thank you for your input.

    We changed the shipping method last week, so it’s not a problem anymore. Thank you for your time!

    Plugin Author Shea Bunge

    (@bungeshea)

    Glad you could solve the problem!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Woocommerce – Remove specific shipping method’ is closed to new replies.