MageSmith
MutationReview · Magento 2.4.9

createProductReview

createProductReview is a Magento 2 GraphQL mutation in the Review module. Create a product review for the specified product. It returns CreateProductReviewOutput! and requires an Authorization header (Bearer customer token).

Last verified: against Magento 2.4.9.

Returns

CreateProductReviewOutput!

Resolver class

Magento\ReviewGraphQl\Model\Resolver\CreateProductReview

Arguments

input CreateProductReviewInput! Required

An input object that contains the details necessary to create a product review.

Example request

Auto-generated from the SDL — paste-ready against your store's /graphql endpoint. Replace the host, store code, and any required values before running.

Headers

Content-Type
application/json
Store
default store view code; use 'default' for the single-store baseline
Authorization
Bearer <CUSTOMER_TOKEN> obtain from generateCustomerToken mutation

Query

mutation ($input: CreateProductReviewInput!) {
  createProductReview(input: $input) {
    review {
      product {
        id
        uid
        name
        sku
        description { ... }
        short_description { ... }
        special_price
        special_from_date
        special_to_date
        attribute_set_id
        meta_title
        meta_keyword
        meta_description
        image { ... }
        small_image { ... }
        thumbnail { ... }
        new_from_date
        new_to_date
        tier_price
        options_container
        created_at
        updated_at
        country_of_manufacture
        type_id
        websites { ... }
        product_links { ... }
        media_gallery_entries { ... }
        price { ... }
        price_range { ... }
        gift_message_available
        manufacturer
        categories { ... }
        canonical_url
        media_gallery { ... }
        custom_attributesV2 { ... }
        tier_prices { ... }
        price_tiers { ... }
        only_x_left_in_stock
        stock_status
        quantity
        min_sale_qty
        max_sale_qty
        url_key
        url_suffix
        url_path
        url_rewrites { ... }
        related_products { ... }
        upsell_products { ... }
        crosssell_products { ... }
        rating_summary
        review_count
        reviews { ... }
        swatch_image
      }
      summary
      text
      nickname
      created_at
      average_rating
      ratings_breakdown {
        name
        value
      }
    }
  }
}

Variables

{
  "input": {
    "nickname": "",
    "ratings": [
      {
        "id": "",
        "value_id": ""
      }
    ],
    "sku": "",
    "summary": "",
    "text": ""
  }
}

Every Magento dev tool, in one hosted workspace.

Free to sign up. Nothing to install. Drafts, audits, and projects saved across every tool.