M2.2.2 Remove default schema.org rich snippets

This helps me to remove Magento default product schema by following steps.

1. Remove product schema from body. Add this to catalog_product_view.xml under your theme.

<body>
    <attribute name="itemtype" remove="true"/>
    <attribute name="itemscope" remove="true"/>
</body>

2. Remove aggregateRating

Copy this to your theme

vendor/magento/module-review/view/frontend/templates/helper/summary.phtml

remove

itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"

3. Remove Review

Copy this to your theme

vendor/magento/module-review/view/frontend/templates/product/view/list.phtml

Remove

itemscope itemprop="review" itemtype="http://schema.org/Review"

Note: missing #2 and #3 will receive an error similar to below in validation due to action #1

“The review has no reviewed item specified.”

When I added remove='true' to these attributes - I got the following error:

Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'attribute', attribute 'remove': The attribute 'remove' is not allowed.

To get these properties to disappear, I changed them to this instead:

<attribute name="itemtype" value="" />
<attribute name="itemscope" value="" />

Reference for the Solution:

https://github.com/magento/magento2/issues/10889


You can remove the default schema.org from catalog_product_view.xml file. Add below the line of code:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>            
    <attribute name="itemtype" value=""/>
    <attribute name="itemscope" value=""/>
</body>
</page>