Re: Add comment and rating to product using a rest api

Add comment and rating to product using a rest api

lroblesfactorx
Visitor
1 0 1

Hi team! Is there a way to add a comment and rating to a product using a api rest? The only way I see is to use an app, but this doesn't work for me, however it must be through an api 😞

Replies 3 (3)

EcomGraduates
Shopify Partner
735 63 105

Hello there! 

 

Yes, it is possible to add comments and ratings to a product using the Shopify REST API. Shopify provides a set of endpoints for interacting with products, product reviews, and customer reviews.

To add a comment and rating to a product, you will need to make a POST request to the product reviews endpoint with the following information:

  • The product ID
  • The customer's email
  • The comment and rating

Here is an example of a request body for adding a comment and rating to a product:

 

 

{
  "product_id": "1234567890",
  "email": "customer@example.com",
  "title": "Great product!",
  "body": "I am very happy with this purchase. It exceeded my expectations!",
  "rating": 5
}

 

 

You will need to include the Access Token of the store you want to update the products review.

It's important to note that the customer's email is required, but you can also include their name and location. Also, be aware that some shopify themes may not support product reviews, you may need to check if your theme does.

It's also important to keep in mind that you should follow Shopify's best practices and guidelines when developing your application and handling user data. Additionally, you should handle errors and rate limits correctly and make sure that you don't exceed the API's limits.

 

 

 


If this fixed your issue, likes and accepting as a solution are highly appreciated.

Build an online presence with our custom built Shopify Theme EcomifyTheme




EcomGraduates
Shopify Partner
735 63 105

hello there!

 

Yes, it is possible to add comments and ratings to a product using the Shopify REST API. Shopify provides a set of endpoints for interacting with products, product reviews, and customer reviews.

To add a comment and rating to a product, you will need to make a POST request to the product reviews endpoint with the following information:

  • The product ID
  • The customer's email
  • The comment and rating

Here is an example of a request body for adding a comment and rating to a product:

 

 

{
  "product_id": "1234567890",
  "email": "customer@example.com",
  "title": "Great product!",
  "body": "I am very happy with this purchase. It exceeded my expectations!",
  "rating": 5
}

 

You will need to include the Access Token of the store you want to update the products review.

It's important to note that the customer's email is required, but you can also include their name and location. Also, be aware that some shopify themes may not support product reviews, you may need to check if your theme does.

It's also important to keep in mind that you should follow Shopify's best practices and guidelines when developing your application and handling user data. Additionally, you should handle errors and rate limits correctly and make sure that you don't exceed the API's limits.

 


If this fixed your issue, likes and accepting as a solution are highly appreciated.

Build an online presence with our custom built Shopify Theme EcomifyTheme




ShopifyDevSup
Shopify Staff
1453 238 511

Hi @Iroblesfactorx the Product Reviews app from Shopify doesn't use a publicly available API. It's been discussed at length on the forums previously. There are some workaround solutions proposed by other Shopify Partners in this forum thread here that might help you find a solution though. Hope this helps. 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog