Tried adding {{store}} and {{store_name}} in the Mask for Meta Title to output the site name on each product in the Product Fields Auto-Generation. Any idea if possible or what the correct store name variable is? enter image description here

2 Answers 2


Unfortunately auto-generation fields doesn't allow to use store name for mask. And store name could be a problem to generate product meta title in this way because every product could be assigned to the website.

Furthermore I do not think you need this way to generate product title. Here is way would be more useful I think..

Create new module




<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Vendor_Module" setup_version="2.1.0"/>

you need to define new event


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="catalog_product_load_after">
        <observer name="vendor_product_load_after" instance="Vendor\Module\Observer\AfterProductLoad" />

and add event handler app/code/Vendor/Module/Observer/AfterProductLoad.php

namespace Vendor\Module\Observer;

use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\Event\Observer as EventObserver;
use Magento\Store\Model\StoreManagerInterface;

class AfterProductLoad implements ObserverInterface
     * @var StoreManagerInterface
    private $storeManager;

     * @param StoreManagerInterface $storeManager
    public function __construct(
        StoreManagerInterface $storeManager
        $this->storeManager = $storeManager;

    public function execute(EventObserver $observer)
        $product = $observer->getProduct();
        if ($product->getIsMetaApplied()) {
        if ($metaTitle = $product->getMetaTitle()) {
            $metaTitle .= ' | ' . $this->storeManager->getStore()->getName();

do not forget to upgrade system

php bin/magento setup:upgrade

Hope this helps.

  • This will be set product meta title in database but how can we get controller level same thing ? Dec 23, 2019 at 10:31

@Nicholas Miller's answer worked for me but saving products in the admin area resulted in Admin being used as the site name instead. I used

public function getStoreName()
    return $this->_scopeConfig->getValue(

to get the store name instead of


Also, this appends the store name repeatedly so I used explode, implode and array_pop to replace, rather than append to the string, the store's name in the meta title.

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.