-
Notifications
You must be signed in to change notification settings - Fork 9
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
Remove woocommerce_loop_add_to_cart_link filter #237
Conversation
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.
Code here looks fine but I'm seeing some E2E test failures. At a glance, doesn't seem like those are related to this PR but would be ideal to investigate those before we proceed.
Hello @dkotter . I dived on E2E tests today, and I have some findings to share. Broader issueI found that some recent pull requests stumbled on E2E failures.
Starting pointI had chosen the tests Specifically about the "OnePlus 8 pushed to Square with inventory" test, I found challenging to guarantee that a product added to Square catalog could be properly retrieved. The common initial error was regarding to
Failing code
Issues regarding to this approach
I initially replaced the
That made the test to work, but it gave me some insights. Testing observations
Last working codeTest "OnePlus 8 pushed to Square with inventory" from I might add that I ended up unable to gather reliable data to determine a reasonable maximum number of attempts based on expected response times. This may be the next step for this test. But this code below is working and may be used as a future reference.
SuggestionMoving forward with this pull request, ignoring the E2E failing tests as they are not related to the fix, and creating a specific issue to investigate and fix all the problems regarding to E2E tests, allocating around one week of effort to it. Or maybe one issue per failing test, as you prefer. I can create this issue ticket (or tickets) if you find this a good idea, adding failing tests as ticket tasks. The code I added above could be used as a reference, an starting point. Thanks! |
@MiguelAxcar Thanks for the very detailed explanation! I'm fine with moving this PR forward and we can investigate tests in separate issues. I know @iamdharmesh has worked a lot on tests (see #238 as one example of trying to make tests run faster) and he may have thoughts on the best approach here. For now, I'd suggest creating a new issue with the things you've found (could be mostly a copy/paste of your comment) and we can continue discussion there. |
@qasumitbagthariya Note this can go to UAT once QA passes |
QA update: ✅I tested the following on this branch:
TT4 Theme Storefront TT5 Responsive Testing Environment
Steps to Test- As mentioned in the PR description.
|
All Submissions:
Changes proposed in this Pull Request:
This PR removes the
woocommerce_loop_add_to_cart_link
filter and its associated functionality. The goal is to ensure consistent styling between the "Add to Cart" and "Buy Gift Card" buttons for all themes.I found that the button "Buy Gift Card" was being rendered by this piece of code called by
woocommerce_loop_add_to_cart_link
filter. This function was added on 2023 Jul 25 by this PR and the main idea was:Upon inspecting the rendered content, the "Buy Gift Card" button lacked several styling classes present on the "Add to Cart" button. Additionally, the "Add to Cart" button contained a nested
<span>
for the text, while the "Buy Gift Card" button did not. This would explain the "Buy Gift Card" button not matching the "Add to Cart" button styling. The first idea here was using theWP_HTML_Tag_Processor
class to only change button text and link, trying a less visually impactful approach as all the parameters would be kept, instead of recreating the button as it's being done.After researching the code, I found that when attending to this issue, on 2024 Jun 24 this PR added support for the product blocks, changing specifically button "Add to Cart" text and URL, targeting to the product page. A very clean approach, changing only what is necessary in the button.
Then I removed the filter, tested the following features on Block/FSE Themes TT5, TT4 and TT3 and it worked as expected, added by
I also tested on the TT1 Classic Theme and, although it isn't visually appealing, I confirm that main functionality is also working.
Given that, I understand that the filter
woocommerce_loop_add_to_cart_link
can be removed, as the main functionality is being covered by the code added by this PR .Closes #140.
Steps to test the changes in this Pull Request
Additional tests
Changelog entry