Advertisement
daymobrew

WooCommerce - Remove some shipping methods

May 26th, 2015
664
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.56 KB | None | 0 0
  1. <?php
  2. /*
  3. Plugin Name: WooCommerce - Remove Shipping Methods
  4. Plugin URI: http://www.damiencarbery.com
  5. Description: Remove some of the default WooCommerce shipping methods.
  6. Author: Damien Carbery
  7. Version: 0.1
  8. */
  9.  
  10. function aw_remove_shipping_methods( $methods ) {
  11.     $methods_to_remove = array('WC_Shipping_International_Delivery', 'WC_Shipping_Local_Delivery', 'WC_Shipping_Local_Pickup');
  12.     $retained_methods = array_diff($methods, $methods_to_remove);
  13.     return $retained_methods;
  14. }
  15.  
  16. add_filter( 'woocommerce_shipping_methods', 'aw_remove_shipping_methods' );
  17. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement