In WP Travel, users may encounter an issue where their cart becomes empty when the session expires, typically after 5 minutes of inactivity. This short guide will help you fix the Empty Cart issue.

An empty cart situation can be frustrating for users who require more time to complete their booking. But worry not; you can extend this duration using a hook to prevent the cart from being emptied too quickly.

This solution is particularly useful for users who do not use the inventory feature in WP Travel, as the cart data is cleared when the session expires.

To extend the session expiration time, please add the following code to the functions.php file of your child theme, or you can simply add it through a plugin likeΒ code snippets.

For detailed information regarding how to create a child theme, please refer to our knowledge base.

add_filter( 'wp_session_expiration', function( $expiration ) { 
    return 24 * 60 * 60; // Extend session to 24 hours (in seconds) 
});

This code will ensure the session lasts for 24 hours, preventing the cart from being cleared prematurely.

Conclusion:

By extending the session expiration time in WP Travel, you can fix the empty cart issue caused by the default 5-minute session expiration. This solution ensures that users’ cart items remain intact for a longer period, improving the user experience.

Check WP Travel documentation to learn more about configurations, modules, payments, shortcodes, and the WP Travel Rest API.

Your feedback helps us improve. Please share your thoughts.

Need assistance? Contact our support team, join our Facebook community, and subscribe to our YouTube Channel for video tutorials. Thank you for choosing WP Travel.

Get WP Travel Pro