0

How can I edit the {{var alertGrid|raw}} for the magento 2.2.x stock alert email?

I know the template is found in vendor\magento\module-product-alert\view\frontend\email\stock_alert.html but the template references the variable.

I want to remove the product price from the grid.

It appears to be defined here: M2 Product Alert Email, however, I don't see a straightforward way of editing the layout or removing the price.

Alternatively, I could remove the variable from the template, but how do I add back the product name and link to the product?

1

The alertGrid block is rendered using the template /view/frontend/templates/email/price.phtml from the Magento_ProductAlert module.
you can just copy this file to your theme keeping the same path and remove the price from it.
The price is rendered but the lines:

<?= $block->getProductPriceHtml(
                $_product,
                \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE,
                \Magento\Framework\Pricing\Render::ZONE_EMAIL,
                [
                    'display_label' => __('Price:')
                ]
            );
            ?>
  • Thanks. It seems /view/frontend/templates/email/stock.phtml is actually the most appropriate file to copy as I need to edit stock alerts, not price alerts. – RFI Dec 14 '18 at 12:06

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.