List of Reserved Keywords in Magento 2.

Magento 2 has a lot of reserved keywords and they define all the reserved keywords in their native core file.

You can find out all the keywords at vendor/magento/framework/App/Router/ActionList.php file.

Reserved keywords are not used to define any class name, function name or variable name in your code. Continue reading “List of Reserved Keywords in Magento 2.”

How to delete CMS Static Block programmatically in Magento 2?

You can delete CMS static block programmatically using deleteById() function of Magento\Cms\Api\BlockRepositoryInterface interface.

You just need to inject the interface in your constructor and you required only a Static Block id to delete a specific Block. Continue reading “How to delete CMS Static Block programmatically in Magento 2?”

create CMS static block store level programmatically in Magento 2.

Magento store with multiple store view having a feature like you can create multiple Static blocks with the same identifier with different store view.

Using multiple separate store view for the different store will helpful to display different content to the different store view.

You can add/create CMS Static block for only a specific store view using programmatically.

You can create/add any cms static block programmatically via Magento\Cms\Api\BlockRepositoryInterface interface and Magento\Cms\Model\BlockFactory Factory method with the use of above class set inside the __construct() method.

Continue reading “create CMS static block store level programmatically in Magento 2.”