Created
May 18, 2020 10:42
-
-
Save rajeshsingh520/747298aaebbdec74a8f65b3e80993147 to your computer and use it in GitHub Desktop.
Restrict delivery for certain product only
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 | |
| add_filter('pisol_dtt_setting_filter_pi_type', 'allowDeliveryWhenProduct'); | |
| function allowDeliveryWhenProduct($type){ | |
| $delivery_only_for_this_product = 636; | |
| $type = 'Pickup'; | |
| if(isset(WC()->cart)){ | |
| foreach( WC()->cart->get_cart() as $cart_item ) { | |
| if($delivery_only_for_this_product == $cart_item['product_id']){ | |
| $type = "Both"; | |
| } | |
| } | |
| } | |
| return $type; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment