Skip to content

Product Rating

The <product-rating> webcomponent is used to render product current rating.

Usage requires to add two HTML elements with specific slot attribute. First of them must have slot attribute with value rating-with-reviews and the second one must be a template element and have slot attribute with value rating-without-reviews. Which of them will be displayed depends on whether any ratings for this product exist or not.

Attributes

Attribute name Type Default Description
product-id number null product id of the product we want to add to favourites

Example

<product-rating product-id="1">
    <div slot="rating-with-reviews">Content displayed when product has any rating</div>
    <template slot="rating-without-reviews">Content displayed when product does NOT have any rating</template>
</product-rating>
Product has rating
    <product-rating product-id="1">
        Content displayed when product has any rating
    </product-rating>
Product does NOT have rating
    <product-rating product-id="1">
        Content displayed when product does NOT have any rating
    </product-rating>