Fix: Allow verified parameter to be set by REST API request (#50525)

* Rest API  product review the verified parameter is not working

* added changelog

---------

Co-authored-by: 79mplus Admin <36501099+79mplus-admin@users.noreply.github.com>
This commit is contained in:
Naman Malhotra 2024-08-10 00:44:59 +05:30 committed by GitHub
parent 27cc2028f9
commit c8c8a6a56d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 0 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Allow verified parameter to be set by REST API request

View File

@ -472,6 +472,10 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller {
update_comment_meta( $review_id, 'rating', ! empty( $request['rating'] ) ? $request['rating'] : '0' );
if ( isset( $request['verified'] ) && ! empty( $request['verified'] ) ) {
update_comment_meta( $review_id, 'verified', $request['verified'] );
}
$review = get_comment( $review_id );
/**
@ -586,6 +590,10 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller {
update_comment_meta( $id, 'rating', $request['rating'] );
}
if ( isset( $request['verified'] ) && ! empty( $request['verified'] ) ) {
update_comment_meta( $id, 'verified', $request['verified'] );
}
$review = get_comment( $id );
/** This action is documented in includes/api/class-wc-rest-product-reviews-controller.php */