Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 5 years ago.
Improve this questionI'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 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.
Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 5 years ago.
Improve this questionI'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 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.
Share Improve this question asked Aug 7, 2019 at 22:51 Kenton de JongKenton de Jong 556 bronze badges 2- 3 Hey, try to switch the theme with different theme, then check the process again. if issue not come then the issue is in your theme override woo commerce core files.so then you can check into files. maybe settimeout function used in js. – Techno Deviser Commented Aug 13, 2019 at 6:54
- 1 You need to first isolate the component that's causing this before going into the details. Switch to another theme as @TechnoDeviser suggested, then if the delay remains, switch off themes one by one until you find the component that's causing this. Once you know, the answer might be apparent already, or you can then look/trace through the code for this component if all else fails. – alexg Commented Aug 15, 2019 at 12:26
1 Answer
Reset to default 1 +50I would try duplicating this site to a staging area.
Then go through and deactivate all of your plugins except for Woo Commerce. With everything disabled except Woo Commerce and your theme, try and add items to your cart. See if there is a delay for things when you add them to the cart.
If there is no delay, slowly activate your plugins one at a time until your find the plugin that is causing the issues. If there is a delay with only your theme and Woo Commerce, then try switching to a different theme.
This way you can slowly narrow things down to determine what is at fault.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745236299a4617912.html
评论列表(0条)