Repository navigation
Restore rel key in loop add-to-cart filter arguments - #66856
Conversation
Testing GuidelinesHi @Aljullu @woocommerce/woo-fse, Apart from reviewing the code changes, please make sure to review the testing instructions (Guide) and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed. Reminder: PR reviewers are required to document testing performed. This includes:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughWooCommerce loop and block product buttons now initialize permalink link ChangesLoop add-to-cart rel compatibility
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Test using WordPress PlaygroundThe changes in this pull request can be previewed and tested using a WordPress Playground instance. Test this pull request with WordPress Playground. Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a commit that changes plugin code. |
There was a problem hiding this comment.
Heads-up that for testing I used this snippet:
add_filter(
'woocommerce_loop_add_to_cart_args',
function ( $args ) {
if ( ! isset( $args['attributes']['type'] ) || 'button' !== $args['attributes']['type'] ) {
$args['attributes']['rel'] .= ' sponsored';
}
return $args;
}
);Otherwise, I was still getting warnings in this branch and in trunk before #66743 was merged.
Besides that, it LGTM!
Submission Review Guidelines:
Changes proposed in this Pull Request:
In #66743
relwas conditionally removed from Product Button. But we should not change established shape of the publicwoocommerce_loop_add_to_cart_argsfilter arguments. This restores therelkey with an empty value for permalink anchors in the classic and Product Button PHP paths, while retainingnofollowfor direct add-to-cart and external links.Closes #66855.
Bug introduced in PR #66743.
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
woocommerce_loop_add_to_cart_argsthat appendssponsoredto$args['attributes']['rel']without first checking whether the key exists:sponsoredrelationship withoutnofollow.Testing that has already taken place:
Milestone
Changelog entry
Changelog Entry Details
Significance
Type
Message
Changelog Entry Comment
Comment
Created manually.
Release Communication
Select if this PR needs a generated summary for release notes:
When to use each?
Feature Highlight: New features, UI changes, or improvements that merchants/store owners will notice.
Developer Advisory: Breaking changes, deprecations, or changes that affect themes/plugins/extensions.
An AI will analyze your PR and post a draft comment for you to review and edit.