-
Notifications
You must be signed in to change notification settings - Fork 219
Add support for woocommerce_loop_add_to_cart_args filter in Products block #8422
Add support for woocommerce_loop_add_to_cart_args filter in Products block #8422
Conversation
The release ZIP for this PR is accessible via:
Script Dependencies ReportThe
This comment was automatically generated by the TypeScript Errors Report
🎉 🎉 This PR does not introduce new TS errors. |
Size Change: +90 B (0%) Total Size: 1.1 MB
ℹ️ View Unchanged
|
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.
The code gets much cleaner! I left some minor comment, otherwise this is LGTM
Thanks for the review, @dinhtungdu! I updated the PR with your feedback. Would you mind taking another look? |
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.
Thanks for the updates! 🚢
if ( isset( $args['attributes']['aria-label'] ) ) { | ||
$args['attributes']['aria-label'] = wp_strip_all_tags( $args['attributes']['aria-label'] ); | ||
} |
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 💯
Fixes #8020.
Some of this code is based on similar code found in WC core:
Testing
Automated Tests
User Facing Testing
woocommerce-gutenberg-products-block.php
), add these two filters:3.1.
$args
is correctly printed in the screen and includes the args returned in thewoocommerce_loop_add_to_cart_args
filter.3.2. Each Add to cart button has the
custom-class
alongside all other classes.3.3. Each Add to cart button has the
data-foo="bar"
attribute.3.4. A
Lorem ipsum
header is added before each Add to cart button.WooCommerce Visibility
Changelog