All M2 themes I have tested do not have proper structured data/rich snippets. The currency symbol is in the price span, and gets a warning:

An example: link to snippet Problem code cleaned up a bit:

<span itemprop="offers" itemscope itemtype="http://schema.org/Offer">
    <span  data-price-amount="54"  data-price-type="finalPrice" itemprop="price">
    <span class="price">$54.00</span>    </span>
    <meta itemprop="priceCurrency" content="USD" />

Error: price $54.00 (The property $54.00 is not a valid price specification. Find out more about http://schema.org/price.)

If the $ is taken out of <span class="price">$54.00</span> like this it validates fine:

<span itemprop="offers" itemscope itemtype="http://schema.org/Offer">
$<span  data-price-amount="54"  data-price-type="finalPrice" itemprop="price">
<span class="price">54.00</span>    </span>
<meta itemprop="priceCurrency" content="USD" />

But I cannot find which files are creating the price code and which code to change. What is the best way to validate the structured data?

3 Answers 3


This is proper solution and worked

Go to extended file of this:



$block->getSchema() ? ' itemprop="price"' :


$block->getSchema() ? ' itemprop="price" content="' . $block->getDisplayValue() . '"':

Source: https://github.com/magento/magento2/issues/7173


I edited this file -


moved to theme


The line

<?php /* @escapeNotVerified */ echo $block->formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer()) ?>

contains $block->formatCurrency which is causing the error. Remove this or change it to <?php echo $block->getDisplayValue(); ?> and the price will now validate.

You can then hardcore the currency symbol before <span <?php if ($block->getPriceId()) But there is a JavaScript code that will overide this file and add it in. If you do not want this happening -


moved to


and remove the line - priceBoxes.priceBox({'priceConfig': <?php /* @escapeNotVerified */ echo $block->getJsonConfig() ?>}); that was calling the JavaScript.


After struggling for a long time with this problem I found this fix -

<meta itemprop="price" content="<?php echo preg_replace('/[^0-9.]+/', '',strip_tags(Mage::helper('core')->currency($_product->getFinalPrice()))); ?>">

Just insert that line above this one -

<span class="price"><?php echo $_coreHelper->currency($_price,true,false) ?></span>

All credit goes to -


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.