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.
Tag: magento2
-
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 Create a Catalog Price Rule in Magento 2
There are the following steps to create the cart price rule in Magento 2 Create a New Catalog Price Rule Set the Catalog Price Conditions Set the Catalog Price Actions Apply the Rule Create a new Catalog rule Go to Admin Panel, click on the Marketing > Promotions >Catalog Price Rule. To add a new rule, click on the Add New Rule -
How to Setup Promotions / Cart Price Rules in Magento 2
There are the following steps to create the cart price rule in Magento 2 Create a New Cart Price Rule Set the Cart Price Conditions Set the Cart Price Actions Set the Cart Price Labels Apply the Rule Create a new cart rule Go to Admin Panel, click on the Marketing > Promotions > Cart Price Rule. To add a new rule, click on the -
How to Set Production Mode in Magento 2
<h2 id="show-current-magento-2-mode">Show current Magento 2 Mode</h2> <p>Run the following command to show the current mode:</p> <pre class="highlight"><code>php bin/magento deploy:mode:show</code></pre> <p>Currently, we are in default mode. We can set to <strong>Production -
How to Run cron job manually via Command Line in Magento 2
<h2 id="how-to-run-cron-job-manually-via-command-line">To Run cron job manually via Command Line</h2> <p>To run the cron job manually, go to the Magento admin root folder.</p> <div class="language-plaintext highlighter-rouge"> <div class="highlight"> <pre class="highlight"><code>php bin/magento