-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Solves Cross-Sells display variable product #37616
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
Solves Cross-Sells display variable product #37616
Conversation
|
Hey @kshojib It seems that this PR contains #37583 changes. Could you update this branch so it only includes display card-related changes? --
To drop or remove some commits using Git, you can use an interactive rebase. Here's a step-by-step guide:
|
fd8e911 to
dd6dc62
Compare
|
This is the product editing area. I just unassigned PR review from Ghidorah and let @woocommerce/mothra review it. |
|
Hi, Just wanted to check in on my pull request and see if you had a chance to take a look yet. Any feedback would be greatly appreciated. Let me know if there's anything I can do to help move things along. |
|
@kshojib I am unable to reproduce the original issue #37613... When I add a variable product (PRODUCT B) as a cross-sell of another product (PRODUCT A) and then add PRODUCT A to my cart, PRODUCT B is shown as "you may be interested in". When I then add PRODUCT B to my cart, it is removed from "you may be interested in". This sticks even after refreshing my cart page. I'm looping in @woocommerce/proton, that work more closely with the cart code, so that they can review both the original issue (#37613) and this PR to determine if there is an issue still and if this PR addresses the issue. |
|
Please see updates in #37613. Thanks to @stoltzrx, I was able to replicate: the key component is to add a variant (child product) rather than the variable (parent). cc @mattsherman (also, fine to reassign to a Proton reviewer if you prefer). |
mattsherman
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 job on this, @kshojib ! Thanks for submitting this PR to fix this scenario.
Submission Review Guidelines:
Changes proposed in this Pull Request:
Closes #37613.
After reviewing the code in plugins/woocommerce/includes/class-wc-cart.php, I saw that the variation id was not being added to the in_cart array. Instead, the parent id was added.
I added a condition to check if the product is a variation product. Then added the variation id to the array. That solved the problem
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions: