I need to set Open Graph price grouped product in <head> section.

I can get price of simple product in this way:

<meta property="og:price:amount" content="<?php echo $_product->getPriceHtml($_item, true) ?>">

and it works well. But... how can I get price of grouped product (the price of the product associated with the lowest price)?


I solved this way getting the price of the last product associated (the prices of my products associated are the same for each product so I need to check what is the lowest):

<meta property="og:price:amount" content="<?php 

$product = Mage::getModel('catalog/product');
$grouped_product_model = Mage::getModel('catalog/product_type_grouped');
$groupedParentId = $grouped_product_model->getParentIdsByChild($product->getId());
$_associatedProducts = $product->getTypeInstance(true)->getAssociatedProducts($product);

foreach($_associatedProducts as $_associatedProduct) {
    if($ogPrice = $_associatedProduct->getPrice()) {
        $ogPrice = $_associatedProduct->getPrice();

$ogPrice = number_format((float)$ogPrice, 2, '.', '');
echo $ogPrice . " Euro";

?>" />
  • is it possible to give special price for grouped products. – Gem Jan 11 '17 at 9:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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