-
Notifications
You must be signed in to change notification settings - Fork 218
Product Details Block > Fix the review form rating #8431
base: trunk
Are you sure you want to change the base?
Conversation
…b.com/woocommerce/woocommerce-blocks into feat/add-single-product-details-block
…ocks into feat/add-single-product-details-block
…block is used alongside the Classic Single Product Block.
The release ZIP for this PR is accessible via:
Script Dependencies ReportThere is no changed script dependency between this branch and trunk. This comment was automatically generated by the TypeScript Errors Report
🎉 🎉 This PR does not introduce new TS errors. |
Size Change: +74 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.
Thanks for working on this fix! In any case, I'm not sure of the outcome.
If the Product Details is added in a template where the Classic Template block isn't added, I see the select instead of the stars 🤔
Should we continue to render the stars, right?
src/BlockTypes/ProductDetails.php
Outdated
* @return array The updated comment form arguments. | ||
*/ | ||
public function review_comment_form( $comment_form ) { | ||
$comment_form['comment_field'] = '<div class="comment-form-rating"><label for="rating">' . esc_html__( 'Your rating', 'woo-gutenberg-products-block' ) . ( wc_review_ratings_required() ? ' <span class="required">*</span>' : '' ) . '</label><select name="rating" id="rating-select" required> |
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.
If we can fix the stars issue, I think that we should add this logic too.
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 working on this, @nefeline! I can confirm it solves the issue.
I'm not 100% sure about this solution, though. To me, it might be better to update the script that adds the stars in WC core so it supports several instances of #rating
. Sidenote: if we go that route, we should probably also change the selector to not use an id, ie: select[name='rating']
.
I don't have a strong opinion, though. The template is using ids so having the Product Details block + the Classic Template in the same template will give unexpected issues, anyway.
This PR has been marked as If deemed still relevant, the pr can be kept active by ensuring it's up to date with the main branch and removing the stale label. |
This PR has been marked as If deemed still relevant, the pr can be kept active by ensuring it's up to date with the main branch and removing the stale label. |
I'm removing the issue and this PR from the scope of the Blockified Single Product Template. @nefeline feel free to continue to work on this if you want! |
While working on the new Single Product Details block, we noticed the star ratings are duplicated when this block is used alongside the classic Single Product block.
Fixes woocommerce/woocommerce#42475
Screenshots
Testing
User Facing Testing
WooCommerce Visibility
Changelog