Closed brandoncc closed 3 years ago
Hi @brandoncc,
Thank you for opening the issue! It requires further feedback from the WooCommerce Core team. I am adding the needs developer feedback
label to this issue so that the Core team could take a look.
Please note it may take a few days for them to get to this issue. Thank you for your patience.
Hi @brandoncc, thanks for your report, this seems indeed like a bug that needs fixing. For reference, we fixed a similar bug a few months ago.
Prerequisites (mark completed items with an [x]):
Describe the bug When a user chooses variation options on a product page, we see this error in our logs:
Expected behavior The user should find a matching variation, see the price, and be able to purchase it.
Actual behavior The user is presented with a message saying no products matching their selections have been found.
Steps to reproduce the bug (We need to be able to reproduce the bug in order to fix it.) I believe this is another issue with ANSI_QUOTES, since I'm on MySQL 8 and found other similar Github issues where that was the root cause of the bug.
To reproduce this bug, I believe you will need a variable product with two or more selectable attributes (variable products with only one attribute seem to work fine) on MySQL 8 (with ANSI_QUOTES on).
Visit the product page and select options, then view your debug log.
Isolating the problem (mark completed items with an [x]):
Proposed (verified in my system) fix I'm currently on an outdated minor version, but master contains the same code I changed, so I believe this still applies to master.
I went to wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php and changed:
to:
After making this change, I'm able to select variations fine. You can see the exact same options selected in this screenshot as the one above:
You can try it yourself here
Important note: There are variation combinations which actually do not exist, so it is important to test it using the options shown in the screenshot.
WordPress Environment We use the WooCommerce System Status Report to help us evaluate the issue. Without this report we won't be able to fully evaluate this issue.