Skip to content

Instantly share code, notes, and snippets.

@j2machado
Last active July 17, 2025 17:31
Show Gist options
  • Select an option

  • Save j2machado/5fd505b38cd0bfcf4d890d31148d2d64 to your computer and use it in GitHub Desktop.

Select an option

Save j2machado/5fd505b38cd0bfcf4d890d31148d2d64 to your computer and use it in GitHub Desktop.
CheckoutWC Local Pickup - Disable Delivery (shipping) from the Delivery Method selection when the cart total is 25 or less.
<?php
/*
* Turn off Delivery (shipping option) in CheckoutWC's Local Pickup,
* if the WooCommerce cart total is less or equal than 25.
*
* @param bool $disable. Whether to disable Delivery or not.
* @return bool. The filtered value.
*/
add_filter( 'cfw_local_pickup_disable_shipping_option', function( $disable ) {
if( $disable ) {
return $disable;
}
// Get the cart total in integer data type.
$cart_total = ( int ) WC()->cart->get_cart_contents_total();
$disable = $cart_total <= 25;
return $disable;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment