Ari Posted September 14, 2016 Share Posted September 14, 2016 Hi, I'm using the woocommerce bookings plugin and it has a setting that empties the user's cart after 15 minutes. I've identified the code of code that does this: /** * Schedule booking to be deleted if inactive */ public function schedule_cart_removal( $booking_id ) { wp_clear_scheduled_hook( 'wc-booking-remove-inactive-cart', array( $booking_id ) ); wp_schedule_single_event( apply_filters( 'woocommerce_bookings_remove_inactive_cart_time', time() + ( 60 * 15 ) ), 'wc-booking-remove-inactive-cart', array( $booking_id ) ); } I need to increase the time from 15 minutes. I've tested replacing ( 'woocommerce_bookings_remove_inactive_cart_time', time() + ( 60 * 15 ) ) with ( 'woocommerce_bookings_remove_inactive_cart_time', time() + ( 30 * 24 * 60 * 60 ) ) but I did this on the plugin file which will get replaced when updating. I'm trying to remove the plugin filter and then applying a new filter with the increased time on my functions.php file but I'm getting errors with everything I've tried. Can anyone help me with this? Quote Link to comment https://forums.phpfreaks.com/topic/302190-remove-replace-filter-using-functionsphp/ Share on other sites More sharing options...
Solution maxxd Posted September 15, 2016 Solution Share Posted September 15, 2016 (edited) add_filter('woocommerce_bookings_remove_inactive_cart_time', changeDeleteTime()); function changeDeleteTime(){ return time() + ( 30 * 24 * 60 * 60 ); } That should work. What errors are you getting? By the way, I truly mean should - I've not tested it. Edited September 15, 2016 by maxxd Quote Link to comment https://forums.phpfreaks.com/topic/302190-remove-replace-filter-using-functionsphp/#findComment-1537588 Share on other sites More sharing options...
Ari Posted September 15, 2016 Author Share Posted September 15, 2016 It worked wonderfully! Thank you, thank you, thank you Quote Link to comment https://forums.phpfreaks.com/topic/302190-remove-replace-filter-using-functionsphp/#findComment-1537607 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.