Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save maxrice/366196bce310866499d3 to your computer and use it in GitHub Desktop.
Save maxrice/366196bce310866499d3 to your computer and use it in GitHub Desktop.
WooCommerce Local Pickup Plus - Remove pickup location action
function wc_local_pickup_plus_remove_pickup_location() {
$methods = WC()->shipping->load_shipping_methods();
if ( isset( $methods['local_pickup_plus'] ) ) {
remove_action( 'woocommerce_after_template_part', array( $methods['local_pickup_plus'], 'review_order_shipping_pickup_location' ), 10, 4 );
}
}
add_action( 'wc_shipping_local_pickup_plus_init', 'wc_local_pickup_plus_remove_pickup_location' );
@JorgeFurioso
Copy link

I am trying to use this to remove a specific location when an specific item(s) is in the cart. I set up a basic if-then statement that triggers if "Local Pick Up Plus" is an available, and any of these product ID's are present in the cart, remove this location. I am getting hung up on how to specify which location I want to remove. Any ideas? I would be eternally grateful for any hints.

@artisanpixel
Copy link

Any progress on this? I am looking at using local pickup plus and need to do something similar. I need to unset certain payment gateways based on which pickup location is selected. I'd be very grateful if you could post your final solution.

@artisanpixel
Copy link

I created a gist that accomplished the functionality that I was looking for. Hope this helps someone else.

https://gist.github.com/artisanpixel/70eb6ad21d105a12741e98f5a4088cbf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment