Skip to content

Commit c462a13

Browse files
authored
Merge pull request #2437 from magento-tango/MAGETWO-70329-2
MAGETWO-70329 [GITHUB] The rich snippets are giving a warning for the element price #7173
2 parents b5580f4 + 74ee5d7 commit c462a13

File tree

3 files changed

+11
-11
lines changed
  • app

3 files changed

+11
-11
lines changed

app/code/Magento/Catalog/view/base/templates/product/price/amount/default.phtml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,11 @@
2222
class="price-wrapper <?php /* @escapeNotVerified */ echo $block->getPriceWrapperCss(); ?>">
2323
<?php /* @noEscape */ echo $block->formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer()) ?>
2424
</span>
25-
<?php if ($block->getSchema()): ?>
26-
<span class="_hidden" itemprop="price">
27-
<?php /* @noEscape */ echo $block->getDisplayValue() ?>
28-
</span>
29-
<?php endif; ?>
3025
<?php if ($block->hasAdjustmentsHtml()): ?>
3126
<?php echo $block->getAdjustmentsHtml() ?>
3227
<?php endif; ?>
3328
<?php if ($block->getSchema()): ?>
29+
<meta itemprop="price" content="<?php /* @noEscape */ echo $block->getDisplayValue(); ?>" />
3430
<meta itemprop="priceCurrency" content="<?php /* @escapeNotVerified */ echo $block->getDisplayCurrencyCode()?>" />
3531
<?php endif; ?>
3632
</span>

app/code/Magento/GroupedProduct/view/base/templates/product/price/final_price.phtml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,19 @@ $minProduct = $block->getSaleableItem()
1717
->getMinProduct();
1818

1919
if ($minProduct) {
20+
$finalPrice = $minProduct->getPriceInfo()->getPrice('final_price');
21+
$finalPriceValue = $finalPrice->getAmount();
2022
$amountRender = $block->getRendererPool()
2123
->createAmountRender(
22-
$minProduct->getPriceInfo()->getPrice('final_price')->getAmount(),
24+
$finalPriceValue,
2325
$minProduct,
24-
$minProduct->getPriceInfo()->getPrice('final_price'),
26+
$finalPrice,
2527
['include_container' => true]
2628
);
29+
$currencyCode = $amountRender->getDisplayCurrencyCode();
30+
} else {
31+
$finalPriceValue = 0;
32+
$currencyCode = '';
2733
}
2834
?>
2935
<div class="price-box" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
@@ -32,4 +38,6 @@ if ($minProduct) {
3238
<span class="price-label"><?php /* @escapeNotVerified */ echo __('Starting at')?></span><?php echo $amountRender->toHtml();?>
3339
</p>
3440
<?php endif ?>
41+
<meta itemprop="price" content="<?php /* @noEscape */ echo $finalPriceValue; ?>" />
42+
<meta itemprop="priceCurrency" content="<?php /* @noEscape */ echo $currencyCode; ?>" />
3543
</div>

app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,6 @@
189189
&:last-child {
190190
margin-bottom: 0;
191191
}
192-
193-
&._hidden {
194-
display: none;
195-
}
196192
}
197193
}
198194
}

0 commit comments

Comments
 (0)