-
Notifications
You must be signed in to change notification settings - Fork 10.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Random items added to order after v2 -> v3 upgrade #15671
Comments
@elliotcondon if you dump your session/cart, whats in there? I'm not aware of any BW compat code that would add items to an order. |
Hey guys, this almost sounds like the exact issue I'm experiencing and I'm attempting to debug it. Sometimes random items get added to the cart, or items get added to orders and their credit cards re being charged for items they didn't add. I'm in the process of cleaning up any items that appear in the error log, but the only endpoint I personally added to the add cart was one ajax function, and that is not being called as far as I can tell when this happens. |
@mikejolley @elliotcondon Let me know if you guys find a solution while I poke around also. |
Hi @mikejolley, thanks for the reply. Here's an odd twist to the issue. I wasn't able to find any issues with any data in the cart, and can confirm that all data was correct during the I won't be able to do any in-depth debugging anymore as the checkout is now working as expected. |
I wonder if that was just a co-incidence. I'm thinking there may have been a rogue item in the cart itself, maybe not visible. |
@mikejolley I'm not sure that that is what is/was happening in my instance. I did not add those items to my cart, and other people were getting items in their cart they didn't see yet. @elliotcondon Thanks, I will try that. |
Look at your sessions table once a product appears and see what is there. The other thing it could be is caching i.e you taking someone elses session. |
@mikejolley @elliotcondon I backed up the database and ran the database upgrade script. Hopefully this fixes it. When I personally experienced the problem, I was able to fix it by manually removing the products from the cart and updating everything. Ever since I did that, it didn't occur for me anymore. Before I updated the cart for myself personally, it had a random product in the cart when I would refresh the page before I even added anything. |
Really it sounds like something ended up in the cart that should not have been there. |
I've had no luck pinpointing a cause nor replicating this sadly. If anyone else comes across this, please dump the data in user carts and share here for review. |
Hi @mikejolley. Thanks for taking a look, here's hoping it's just a random one off bug that is super rare! |
We're hitting this issue post 2.x to 3.1.1. Not even sure where to start. We've worked with WPEngine to disable caching nearly everywhere. We've gone in circles trying to track down how this happens post-checkout. How can we debug this and supply info? |
I have been searching high and low for the cause of this. I recently updated from 2.6.14 and went to 3.1.1. I have made sure any plug in that has something to do with WC has been updated with 3.0+ compatibility. We keep having random items added to carts during check out. The item is not paid for. Youll see the sub total is a higher amount but the price paid is a lower amount. I am also seeing that item disappear from orders as well. Its very strange. |
Hello. I have recently experienced this issue on a client's site. I upgraded them from an older version of WooCommerce, new theme and everything. They even have a custom plugin with advanced custom fields to create rentals in their WooCommerce site. What I did was go to the Tools in WooCommerce under "Status". I ran the following:
And the issue disappeared. I do not know if this is a permanent fix, I just did this now on a staging site. Back up your DB before running this and confirm for me here if it fixes it for you guys as well. |
@mikejolley I don't know if there is anything I can do to help you replicate, without providing you the contents of an established client's site (before the WooCommerce upgrade) which obviously I can't do for good reason. But perhaps we can add some sort of check for old data / existing data after doing an upgrade? Are there any of these options in the Status Tools that we can run on a plugin update automatically? etc. Thoughts? |
I wanted to follow up because we ran these items on the live site for this client. It did not fix the problem for anyone who was currently logged in, etc. The client had to logout and clear their browser cache before this would be in effect. We still do not have the custom cart item data after the checkout process. We're looking into that further. EDIT: After some more testing it seems the client is continuing to have issues with their orders. I am going to do some more extensive testing with them over the next 12-24 hours and will post back with our findings. |
Ensure you have checkout/cart excluded from caching - thats often related. |
This is after having WPEngine turn off Varnish caching and disabling the object cache and cleaning the regular cache, as well as our browser caches. Something is still being retained. But we're also missing additional cart data, even for users who do not have this "caching" problem. I might almost consider this a separate issue. So I'll open a new issue for that. The client ran some tests last night. Apparently, the client can successfully do this when creating a new account or checking out as a guest. But when they login to their original account, they get this issue where it adds random products to the order upon checkout. |
Looks like #16370 |
@apengstrom The common factor is WPEngine... |
This worked on WPEngine before the upgrade to WooCommerce. |
Right, but if there are cache exclusion rules which do not account for the changes in v3 thats not something we'd be able to patch? I suspect regular visitors to your site are having carts assigned to them due to caching. ac-api should be wc-api btw I notice in your screenshot. |
Yeah that's what I was thinking. So Based on the rules noted in the screenshot above, is the ac-api the only wrong one currently? I can have them add an additional one for wc-api= to exclude args and see if that helps. |
Hmm what about the WC session cookies? |
Quick somewhat unrelated question, but regarding the current issues I am experiencing, when using add_action or add_filter, referencing a hook, we need to use the defined "woocommerce_hook_name" whereas in a function call, we use "wc_hook_name()", in terms of naming conventions, is this accurate for v3.x.x+ ? |
@apengstrom The session one is only a prefix - does that match them correctly? yes naming like that is correct. |
@mikejolley Yes they have a custom plugin someone built for them a while back that makes some custom vars, now I'm not entirely sure they are stored there but just in case I had WPEngine add it as a prefix to the exclusions list just to cover all basis (am tired of dealing with caching issues). They are testing now. I will let you know on this thread with the results of what happens going forward now that all these changes are made. The other issue with cart meta not coming through was due to a inconsistency in naming conventions (mentioned above) in their custom plugin, I fixed that as well. |
@mikejolley Client affirms that they have been able to do the testing on their account that was having issues, without a problem. I am assuming at this point the Varnish cache exclusions you had me make yesterday attributed to this. |
My client is having the same issue. When users add items to cart at the same time, users can see more than their own items. Sometimes some random items/orders. This site is also hosted on WPengine. I've asked WPengine to exclude the urls list in this ticket. Problem not solved. |
My client is having the same issue, but I am not on WPEngine. Using Nginx with fastcgi cache. fastcgi_cache_use_stale error timeout invalid_header http_500; if ($request_method = POST) { if ($query_string != "") { if ($request_uri ~* "/wp-admin/|/deploy/|/xmlrpc.php|wp-..php|/feed/|index.php|sitemap(_index)?.xml|/shopping/|/store.|/cart.|/my-account.|/checkout.|/addons.|/ideas.*") { if ( $arg_add-to-cart != "" ) { |
Is anyone having this issue and using WP Rocket? |
Hi @tcope25 - From what I can see, it looks like WP Rocket is fully compatible. I'd check if you have caching being done elsewhere. https://wp-rocket.me/faq/wordpress-caching-plugins-for-woocommerce/ "WP Rocket is fully compatible. No extra configuration is needed. All WooCommerce pages are automatically detected and not cached." |
I also have 'Abandoned Cart Lite for WooCommerce' plugin - could this be causing the issue? |
@tcope25 There could be many issues for this, if you feel there is a plugin incompatibility what I'd do is set up a test environment and then disable any plugin(s) you feel could be causing an issue, until it either works or until you have no plugins to disable. I'd also test with a default WP theme, if you find plugins aren't an issue. |
Are you using Returns and Warranty Requests plugin by any chance? It was reported to cause some problems in #17660. Just guessing, could be something else as well. |
No, I don't have that plugin. Thanks for the mention though!
…On Tue, Mar 19, 2019 at 6:04 AM Peter Fabian ***@***.***> wrote:
Are you using Returns and Warranty Requests plugin by any chance? It was
reported to cause some problems in #17660
<#17660>. Just guessing,
could be something else as well.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<https://mailtrack.io/trace/link/b78262c62a369cbab30b5ea62a827fac39f38da1?url=https%3A%2F%2Fgithub.com%2Fwoocommerce%2Fwoocommerce%2Fissues%2F15671%23issuecomment-474308772&userId=2096159&signature=783247f3b2929f6d>,
or mute the thread
<https://mailtrack.io/trace/link/57b0a13d7efca6b52fed07e62d3b5cb15e7d07c9?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABIK_Kg0Ohalxhm2vD7I1Tzll0UznWvwks5vYMQ7gaJpZM4N9bz4&userId=2096159&signature=573d784aab5b540b>
.
|
If you are using https://getquick.link/ by just adding it to the head then this can cause the same issue as well, so instead of adding the script in the head you can use its plugin |
I have the same issue. I’m hosted on WP Engine and use WP Rocket. I realized the “random items” are not random. It’s from other customer’s cart. They don’t know each other and they are far away from each other. What comes worse to my site is: customer A and B, they don’t know each other and they live far away. Customer A placed an order, about few minutes later, customer B placed an order. Customer B’ shipping address shows customer A’ address. Customer B contacted me to get her address fixed. Until now the problem still unsolved. |
Hi @DogcomeTank , If you manage to replicate the problem, we'd be happy to fix it. The problem is that it's very elusive and we haven't managed to find a way how this is happening. It would be great if you could test this out only with WC core plugin active to see if there is any other plugin causing this. It's possible that it's caused by some caching, but it's difficult to guess. Also, sharing your system status report would help. What's more important, though, is that this particular topic relates to problems customers were having when migrating from WC 2 to WC 3, so it might not be related to this issue at all, so starting a new issue could be beneficial. |
I just ran into very similar issue, and I fixed it. We are using Sucuri & WP Rocket. We ran into an issue where items were being added to the cart when users visited the homepage without any user input. The user would then view their cart, and the items would be removed automatically with a warning from WooCommerce. I fixed this issue by clearing Sucuri & WP Rocket cache (which I don't think did much), but most importantly, CLEARING TRANSIENTS. This is done through Settings>WP Rocket>Database>Transients Cleanup Check the boxes for bot Expired Transients & All Transients, then click the "Optimize" button at the bottom of the page. Hope this helps somebody. |
Hello peterfabian, |
Thank you. I’ll give it a try. |
EXPLANATION OF THE ISSUE
Hi guys,
Elliot here from Advanced Custom Fields.
I'm experiencing a really strange issue and have tried my best to debug it, but am at a loss.
I've just upgraded WC to 3.0.8 (from 2.6.9) and now each order that gets created (during checkout) contains an extra random product.
I've dug through the source code and can provide these findings:
WC_Checkout->create_order()
WC_Abstract_Order->add_item()
functionI have deactivated all plugins and swapped to the default WP theme to test, and the issue persists!
I have a feeling this issue must be related to the upgrade and some 'legacy' or 'compatibility' code is tripping itself up.
I'm happy to do any code debugging, please let me know if you have any thoughts on how I can fix this.
SYSTEM STATUS
Home URL: https://www.advancedcustomfields.com
Site URL: https://advancedcustomfields
WC Version: 3.0.8
Log Directory Writable: ✔
WP Version: 4.8
WP Multisite: –
WP Memory Limit: 256 MB
WP Debug Mode: ✔
WP Cron: ✔
Language: en_US
Server Environment
Server Info: Apache
PHP Version: 5.6.25
PHP Post Max Size: 32 MB
PHP Time Limit: 30
PHP Max Input Vars: 1000
cURL Version: 7.50.0
OpenSSL/1.0.2h
SUHOSIN Installed: –
MySQL Version: 5.6.28
Max Upload Size: 32 MB
Default Timezone is UTC: ✔
fsockopen/cURL: ✔
SoapClient: ✔
DOMDocument: ✔
GZip: ✔
Multibyte String: ✔
Remote Post: ✔
Remote Get: ✔
Database
WC Database Version: 2.6.9
WC Database Prefix: wp_
woocommerce_sessions: ✔
woocommerce_api_keys: ✔
woocommerce_attribute_taxonomies: ✔
woocommerce_downloadable_product_permissions: ✔
woocommerce_order_items: ✔
woocommerce_order_itemmeta: ✔
woocommerce_tax_rates: ✔
woocommerce_tax_rate_locations: ✔
woocommerce_shipping_zones: ✔
woocommerce_shipping_zone_locations: ✔
woocommerce_shipping_zone_methods: ✔
woocommerce_payment_tokens: ✔
woocommerce_payment_tokenmeta: ✔
Security
Secure connection (HTTPS): ✔
Hide errors from visitors: ✔
Active Plugins (7)
Advanced Custom Fields PRO: by Elliot Condon – 5.5.14
Disable Password Change Email: by Andrej Pavlovic – 1.0.0
Limit Login Attempts: by Johan Eenfeldt – 1.7.1
My Dashboard: by Elliot Condon – 1.0.0
WooCommerce Stripe Gateway: by WooCommerce – 3.2.0
WooCommerce: by Automattic – 3.0.8
Yoast SEO: by Team Yoast – 4.9
Settings
API Enabled: –
Force SSL: –
Currency: AUD ($)
Currency Position: left
Thousand Separator: ,
Decimal Separator: .
Number of Decimals: 2
Taxonomies: Product Types: external (external)
grouped (grouped)
simple (simple)
variable (variable)
Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
exclude-from-search (exclude-from-search)
featured (featured)
featured (featured-2)
outofstock (outofstock)
outofstock (outofstock-2)
rated-1 (rated-1)
rated-1 (rated-1-2)
rated-2 (rated-2)
rated-3 (rated-3)
rated-3 (rated-3-2)
rated-4 (rated-4)
rated-4 (rated-4-2)
rated-5 (rated-5)
rated-5 (rated-5-2)
WC Pages
Shop base: ❌ Page not set
Cart: #1483 - /cart/
Checkout: #1484 - /checkout/
My account: #1485 - /my-account/
Theme
Name: Advanced Custom Fields
Version: 3.1.0
Author URL:
Child Theme: ❌ – If you're modifying WooCommerce on a parent theme you didn't build personally
then we recommend using a child theme. See: How to create a child theme
WooCommerce Support: ✔
Templates
Overrides: acf/.DS_Store
acf/woocommerce/checkout/form-billing.php
acf/woocommerce/checkout/form-checkout.php
acf/woocommerce/checkout/form-coupon.php
acf/woocommerce/checkout/thankyou.php
acf/woocommerce/emails/customer-completed-order.php
acf/woocommerce/emails/customer-new-account.php
acf/woocommerce/emails/email-footer.php
acf/woocommerce/emails/email-header.php
acf/woocommerce/emails/email-styles.php
acf/woocommerce/myaccount/dashboard.php
acf/woocommerce/myaccount/my-account.php
acf/woocommerce/myaccount/my-orders.php
acf/woocommerce/myaccount/navigation.php
acf/woocommerce/myaccount/view-order.php
acf/woocommerce/order/order-details.php
`
The text was updated successfully, but these errors were encountered: