I'm working with a client to create a WooCommerce shopping site. However, for some reason after people add items do their cart, these items take approximately 30 seconds to actually add to the cart.
I have been able to determine that the WooCommerce session is not being set immediately. Products are being saved in the database, but the session cannot access them until shortly afterwards.
I created a shortcode to print out the sessions so that I can see what's happening. This script is irrelevant, but it is as follows:
function test_func( $atts ){
$customer = @WC()->session;
return print_r($customer);
}
add_shortcode( 'test', 'test_func' );
Here is a screenshot of the cart directly after adding the product. Note how it says "Your cart is currently empty" and the _customer_id:protected value:
Here is a screenshot from phpMyAdmin which shows the session being stored:
And 32 seconds after the first screen shot, I refreshed the page and this appeared, matching the _customer_id.
So my question: why is there a 30-second delay and how can I fix it?
I have already tried changing WooCommerce to go straight to checkout (didn't work) and I have used these tips from BusinessBloomer.com that everybody links to.
I am running WooCommerce v.3.6.5, running WordPress 5.2.2, with PHP version 7.0.33. My host is GoDaddy.