-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Added the parent's SKU to product searches for variations #27171
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
Conversation
Since the parent's SKU is used when the variation does not have one, we should fall back when searching for consistency.
rrennick
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ObliviousHarmony This looks great except the nitpick in the DB prepare.
jonathansadowski
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work. 👍
I added a note to the comment re: numbered arguments. I agree that it's best to leave the non-numbered arguments for now.
|
Noting that the failing check is the nightly build failures fixed in master |
This commit replaces double quotes with single quotes inside a MySQL query to avoid a syntax error when the SQL mode ANSI_QUOTES is enabled in MySQL. When this mode is enabled, MySQL treats double quotes as identifiers (like the backtick character) instead of as string delimiters. Before this change, sites running with this mode enabled wouldn't be able to add products to orders created manually in the admin as the modified query would fail (other places that also use product search including variations would fail as well). The commit that introduced this issue shipped in WC 4.5.0 (see #27171).
All Submissions:
Changes proposed in this Pull Request:
When a variation has no SKU filled out it will default to the parent's in most cases. A caveat here however is that searching does not take this behavior into consideration. This PR adds a join to the product search for the parent's lookup table for variations and checks the SKU of the parent when the child does not have one entered.
I also considered making this change in
get_data_for_lookup_table()but it seemed like invalidating the entire table would be problematic and theproduct_idis already indexed on the lookup table.Closes #25543.
How to test the changes in this Pull Request:
parent-skuandchild-skuon ONE of the children.parent-sku. Without the PR no variations will be visible, with the PR, the variation that has no SKU will show up.child-skuand note both with and without the PR the variation with the SKU will show up.Other information:
Changelog entry