Magento 2 edit {{var alertGrid|raw}}
-
07-02-2021 - |
質問
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?
解決
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:')
]
);
?>