Last active
July 17, 2025 17:31
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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