Skip to content

Instantly share code, notes, and snippets.

@clintN
Created November 5, 2017 03:26
Show Gist options
  • Select an option

  • Save clintN/dc7a8425cbc4a911ebd6e9575dff2f36 to your computer and use it in GitHub Desktop.

Select an option

Save clintN/dc7a8425cbc4a911ebd6e9575dff2f36 to your computer and use it in GitHub Desktop.
if Local Pick-up condition
/**
* Do something if local pickup
*/
add_action( 'woocommerce_after_checkout_form', 'bbloomer_disable_shipping_local_pickup' );
function bbloomer_disable_shipping_local_pickup( $available_gateways ) {
global $woocommerce;
$chosen_methods = WC()->session->get( 'chosen_shipping_methods' );
$chosen_shipping_no_ajax = $chosen_methods[0];
if ( 0 === strpos( $chosen_shipping_no_ajax, 'local_pickup' ) ) {
echo '<h1>Hello World</h1>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment