We use cookies to make your experience better. To comply with the new e-Privacy directive, we need to ask for your consent to set the cookies. Learn more.
Magento 2
-
How to Setup Google Shopping Feed for Magento 2 Programmatically
What is Google Shopping? Google Shopping is an e-commerce website that provides customers to search for your product. Online stores can upload their stores’ data and products’ information on Google Shopping by using Google Merchant to boost their marketing and sales performance. Magento 2 does not allow feed generating, you need to install -
Magento 2 Display Error Enable Error Reporting Programmatically
You can display error/enable error reporting in Magento 2 by using these methods, Method 1: Rename pub/errors/local.xml.sample file Method 2: Edit .htaccess file Method 3: Edit app/bootstrap.php file Method 1: Rename pub/errors/local.xml.sample file Open the Magento root directory. Open the pub/errors. You will see a file in this -
How to check if current url is homepage in Magento 2 Programmatically
To check if the current URL is the homepage in Magento 2, follow these steps. Create the block class Declare function in template .phtml file Get output in index.php file Create the block class Directory app/code/VendorName/ModuleName/Block/Demo.php Contento of Demo.php <?phpnamespace VendorName\ModuleName\Block;class Demo extends \ -
How to extend layout in Magento 2 Programmatically
Follow the following steps to extend the layout in Magento 2 Create theme extending file Processing extending layouts Create theme extending file Add extending page configuration or generic layout file <theme_dir>|__/<Namespace>_<Module>|__/layout|--<layout1>.xml|--<layout2>.xml For example, to customise/ -
How to Get Categories from specific Product in Magento 2 Programmatically
To get categories from specific products in Magento 2, create the block class in your module. Directory app/code/VendorName/ModuleName/Block/Demo.php Content of Demo.php <?phpnamespace VendorName\ModuleName\Block;class Demo extends \Magento\Framework\View\Element\Template{ protected $_categoryCollectionFactory;protected $_productRepository; -
How to get Currency data: Code, Rate, Symbol in Magento 2
There are the steps to get the currency data like code, rate, and symbol in Magento 2 create the block class Get the output of the currency data in phtml file Create the block class Directory app/code/VendorName/ModuleName/Block/Demo.php Content of Demo.php <?phpnamespace VendorName\ModuleName\Block;class Demo extends \ -
How to get Logo url, Image Url, Alt text, Logo size in Magento 2 Programmatically
There are the steps to get logo url, image url, Alt text and logo size in magento 2 create the block class Declare function in template (.phtml) file Create the block class Directory app/code/VendorName/ModuleName/Block/Demo.php Content of Demo.php <?phpnamespace VendorName\ModuleName\Block;class Demo extends \Magento\Framework\View\ -
How to Add Command line in to Console CLI in Magento 2
Follow these steps add the command line in to console CLI in magento 2. create the di.xml create command class Create di.xml file In di.xml file you will define the command. Directory app/code/VendorName/ModuleName/etc/di.xml Content of di.xml <?xml version="1.0"?><config xmlns:xsi="http://www.w3.org/2001/XMLSchema- -
How to get store information in Magento 2 Programmatically
There are the following steps to get the store information in Magento 2: Create the block class Get store information in phtml file Create the block class Directory app/code/VendorName/ModuleName/Block/Demo.php Content of Demo.php <?phpnamespace VendorName\ModuleName\Block;class Demo extends \Magento\Framework\View\Element\Template{ -
How to Create and Assign Customer Group in Magento 2
To create the customer group follow these steps: Go to Admin Panel, click on the CUSTOMERS > Customer groups. Click on the Add New Customer Group button. In the field of Group Name, set the group name. Select the Tax Class. In the field of Excluded Website, Select websites you want to exclude from this customer group. Click on the Save