Posts

Steps to Setup Auto-Completion for Shopify CLI Commands

Image
Following steps will help auto-complete shopify CLI commands when you press the tab button.

Steps to Setup Shopify Dev Environment using Homebrew for Mac

Image
If you're a developer setting up a Shopify development environment on a MacBook (for building themes, apps, or custom features), you’ll need to install some tools like the Shopify CLI. Follow below steps for installation:

SEO for your Press Releases [Updated 2025 list]

Image
This article will help you Search Engine Optimize and Publish your/client's Press Releases Online: Prepare and proof-read the press release for Online Submissions: Make the press release easy to find online. Know the search terms that the online audiences use when they search for you on Google. Incorporate those search terms into the press release, particularly into the first 250 words. Wherever possible, convert keyword phrases into anchor text, which will greatly increase the Search Engine Optimization value of the online press release. Accompany the press-release with an image/video to increase the readership Include complete contact information on the bottom of your press release including your name, phone number, e-mail address, physical address and website URL. Utilize low cost or free press release submission sites that are also SEO friendly to publish the press release. Submit the press relea...

Magento 2: Delete sample data and test data from your store

Here is a script to delete all the test data from your magento store. This can come in handy especially at the time of launching your website from beta to production mode. Don't forget to bookmark it for your next launch. NOTE: It is advisable to take full database backup before performing any operations below: SCRIPT: SET FOREIGN_KEY_CHECKS=0; # Clean order history TRUNCATE TABLE `sales_bestsellers_aggregated_daily`; TRUNCATE TABLE `sales_bestsellers_aggregated_monthly`; TRUNCATE TABLE `sales_bestsellers_aggregated_yearly`; # Clean order infos TRUNCATE TABLE `sales_creditmemo`; TRUNCATE TABLE `sales_creditmemo_comment`; TRUNCATE TABLE `sales_creditmemo_grid`; TRUNCATE TABLE `sales_creditmemo_item`; TRUNCATE TABLE `sales_invoice`; TRUNCATE TABLE `sales_invoiced_aggregated`; TRUNCATE TABLE `sales_invoiced_aggregated_order`; TRUNCATE TABLE `sales_invoice_comment`; TRUNCATE TABLE `sales_invoice_grid`; TRUNCATE TABLE `sales_invoice_item`; TRUNCATE TABLE `sales_order`; TRUNCATE...

Magento 2 - How to generate translation strings for your magento project

If you have want to create a multi-language store then you may require to translate all English strings into the language of your choice. For this you will need accumulate all of the eligible strings for translation into a CSV file. In this article we will discuss how to generate this list of strings from your Magento project which are eligible for translations. Magento allows the list generation with following command: For Whole Project: php bin/magento i18n:collect-phrases --magento -o translations.csv cat translations.csv For A Particular Module: php bin/magento i18n:collect-phrases path/to/my/module -o translations.csv cat translations.csv Thenafter, this CSV file (translations.csv in above example) can be translated either manually or using third party translator extensions like Qordoba.

Elastic Search - How to install and manage multiple versions of elastic search

It is possible to install and manage multiple versions of elastic search using an Elastic search version Manager. You can simply follow below steps to install EVM and start Elastic search with your desired version: STEPS sudo curl -o /usr/local/bin/evm https://raw.githubusercontent.com/duydo/evm/master/evm sudo chmod +x /usr/local/bin/evm evm install 7.4.0 /** You can replace 7.4.0 with your desired elastic search version **/ evm install 5.4.0 /** You can replace 5.4.0 with your desired elastic search version **/ evm use 7.4.0 /** You can replace 7.4.0 with your desired elastic search version **/ evm start curl http://localhost:9200 If you want to install another version, then you can stop the EVM and install another version in the similar manner. NOTE: For this Tutorial we have used Duydo EVM which is available here: https://github.com/duydo/evm to download and run elasticsearch version 7.4.0.

Xdebug - PHPStorm - Ubuntu: How to configure Xdebug on Ubuntu for PHPStorm

Image
For this illustration we are using PHP7.3 Find the path of your PHP ini files by opening the console and running following command: php --ini In your root folder create a new file using following command and generate Phpinfo file: sudo vi phpinfo.php Now in your browser run: http://localhost/phpinfo.php . Copy the entire output from this page and paste it into https://xdebug.org/wizard This will give you the download link to xdebug. Now open your console and run below commands: Check the path against "Scan the additional .ini files in". In most cases the path would look something like "/usr/local/etc/php/7.3/conf.d" sudo vi /usr/local/etc/php/7.3/conf.d/ext-xdebug.ini Now in your PHPStorm perform below steps: Click on PHPStorm > Preferences > Languages & Frameworks > PHP > Debug Under Xdebug > Change "Debug Port" to "9001" and select "Can accept external connections Click on Apply Yo...

Instagram - How to unfollow someone's posts without actually unfollowing their account

Image
Instagram now provides a feature where in you can unfollow/ignore someone's posts and activity without actually unfollowing the account. Instagram will not notify the person about this. This is a fantastic feature of instagram which can help avoid unwanted content from an account without needing to unfollow the account. You can do this by following method: Login to instagram on your browser or mobile app. Navigate to the profile you wish to ignore. Click on the three dots (3 horizontal dots if you are on desktop browser and 3 vertical dots if you are on mobile app) at the top right corner. Now click on "Restrict" from the dropdown list. Now click on "Restrict Account". Now you will no longer see any posts, messages or comments from the restricted account. Any comments left by the restricted account on your posts will remain hidden until you specifically approve the comment. Image sources: Instagram.co...

XDebug - PHPStorm - Mac: How to configure Xdebug with PHPStorm on Mac OS and PHP 7.3

Image
For this illustration we are using PHP7.3 Find the path of your PHP ini files by opening the console and running following command: php --ini In your root folder create a new file using following command and generate Phpinfo file: sudo vi phpinfo.php Now in your browser run: http://localhost/phpinfo.php . Copy the entire output from this page and paste it into https://xdebug.org/wizard This will give you the download link to xdebug. Now open your console and run below commands: Check the path against "Scan the additional .ini files in". In most cases the path would look something like "/usr/local/etc/php/7.3/conf.d" sudo vi /usr/local/etc/php/7.3/conf.d/ext-xdebug.ini Now in your PHPStorm perform below steps: Click on PHPStorm > Preferences > Languages & Frameworks > PHP > Debug Under Xdebug > Change "Debug Port" to "9001" and select "Can accept external connections Click on Apply Yo...

MongoDB - PHP7.3: How to install MongoDB with PHP 7.3.x on a Mac Catalina 10.15.x OS with Homebrew

The usual command to install mongoDB which is as below: pecl install mongodb However, this will fail on MAC Catalina OS with PHP 7.3.x with following error: In file included from /usr/local/Cellar/php@7.3/7.3.23/include/php/Zend/zend.h:335: /usr/local/Cellar/php@7.3/7.3.23/include/php/Zend/zend_operators.h:486:10: error: 'asm goto' constructs are not supported yet __asm__ goto( In order to fix this error, you will need to do below: Optional steps: In case you do not have homebrew installed you can install it with this command: $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" In case you still face issues with mongoDB installation then perform below and try the pecl install mongodb command again -- Download XCode 12 beta CLI tools and XCode 12 beta from https://developer.apple.com/xcode/resources/

Magento 2: How to fix Temando Error logs

If you are not using Temando Shipping module which comes packaged with Out of the Box Magento in your E-commerce site then most likely you will see your var/log/system.log file being spammed with numerous errors that look like below: [2020-09-02 11:13:03] temando.CRITICAL: "accountId" is required. Enter and try again. { "exception":"[object] (Magento\\Framework\\Exception InputException(code: 0): \"accountId\" is required. Enter and try again at /vendor/magento/framework/Exception/InputException.php:91)" } This error is a Core magento bug. It may seem minor, but over a period of time if ignored, it can result in a humungous system log file size and as a result your actual logs and important messages can get lost between these errors. In order to fix this error there are 2 ways: 1) Disable the Temando_Shipping module in your magento site using this command: php bin/magento module:disable Temando_Shipping OR 2) Create a d...

Magento 2: How to place order as a guest customer using Magento 2 REST API

In order to place a new order as a guest customer using REST APIs in Magento 2, please follow below steps: MAGENTO 2 REST APIs: CREATE GUEST CART: NOTE: Quote/Cart ID here is received from Step 1 of creating guest cart. ADD ITEMS TO GUEST CART: GET TOTALS OF GUEST CART: ESTIMATE SHIPPING OF GUEST CART: SET BILLING AND SHIPPING DETAILS OF GUEST CART: PLACE ORDER FROM GUEST CART:

Magento 2: How to login as Customer and place new order via REST APIs

In order to place a new order as a logged in customer using REST APIs in Magento 2, please follow below steps: You can Download the Postman Tool from here: www.postman.com Now, Open Post man and create below Requests: MAGENTO 2 REST APIs: CUSTOMER LOGIN: CREATING CUSTOMER QUOTE: ADD ITEMS TO CART COLLECT CART TOTALS GET AVAILABLE SHIPPING METHODS & ESTIMATING SHIPPING CHARGES SET BILLING AND SHIPPING ADDRESS OF ORDER PLACE ORDER Now check your admin panel and there will be a new COD order placed.

Magento 2: How to create new indexer for your custom module

For this tutorial we will consider an example of a custom module called Vendor_ModuleName. Create below files to generate a new VSBridge indexer and Elastic Index for your own module: Vendor_ModuleName\etc\indexer.xml Vendor_ModuleName\etc\mview.xml Vendor\ModuleName\Model\Indexer\CustomIndexer.php Now, open console and run below command: You will now see following: A new indexer job for your module in Magento admin panel > System > Tools > Index Management A new index in elastic You can refresh your indexer with php bin/magento indexer:reindex my_custom_indexer

Magento 2 - Vue Storefront PWA Integration: How to create a new VSBridge indexer job and Elastic Index for your custom module

For this tutorial we will consider an example of a custom module called Vendor_ModuleName . You need to have the module divante/magento2-vsbridge-indexer installed and configured in your project, in order for it to work with your Vue StoreFront PWA website. You can do this with below command: Once you have the module installed and configured correctly, create below files to generate a new VSBridge indexer and Elastic Index for your own module: Vendor_ModuleName\etc\indexer.xml Vendor_ModuleName\etc\mview.xml Vendor_ModuleName\etc\vsbridge_indices.xml Vendor\ModuleName\Model\Indexer\CustomIndexer.php Vendor\ModuleName\Model\Indexer\Mapping\CustomIndexer.php Vendor\ModuleName\etc\di.xml Now, open console and run below command: You will now see following: A new indexer job for your module in Magento admin panel > System > Tools > Index Management A new index in elastic You can refresh your indexer with php bin/magento indexer:reindex vsbr...

Magento 2: How to create new import entity

If you want to add a custom import feature in your Magento 2 site, you can do this by following steps. This will add a new entity in ADMIN PANEL > SYSTEM > DATA TRANSFER > IMPORT Vendor\Module\etc\import.xml Vendor\Module\Model\Import.php Vendor\Module\Files\Sample\mycustomimport.csv Now, Open your console and run below command: Navigate to ADMIN PANEL > SYSTEM > DATA TRANSFER > IMPORT > IMPORT SETTINGS > Click on the dropdown >. Your custom import entity will appear here.

Magento 2: How to automatically generate Postman Schema for Default Magento 2 APIs

In order to automatically generate the Postman Schema for all of the Default Magento 2 APIs, follow below steps: Open your console, and trigger following CURL requests. This will generate a JSON file in your root directory. Now, Open Postman app > File > Import > Select the JSON file generated above and Voila, you now have the Schema of all Magento 2 APIs.

Magento2: How to stop a product from getting added to cart programmatically?

If youn want to stop a product from getting addded to cart programmatically, add below files to your module: Vendor_Module\etc\di.xml Vendor_Module\Model\Checkout\Cart\AddProduct.php

Magento2: How to add new grid in Category Listing Page

Here is a tutorial on how to add new Grid in Category Listing Page. For this example we will assume we want to add a grid same as Product Category Positions for Category Brands. It should look something like below: Assume that you have a custom module called Namespace_Module. You will create following files in your module: Namespace_Module\view\adminhtml\ui_component\category_form.xml Namespace_Module\Block\Adminhtml\Category\MyCustomGrid.php Namespace_Module\view\adminhtml\templates\catalog\category\edit\assign.phtml Namespace_Module\view\adminhtml\web\catalog\category\edit\assign.js Namespace_Module\Controller\Adminhtml\Category\Assign.php Namespace_Module\Block\Adminhtml\Category\Tab\MyCustomGrid.php For saving, updating and deleting the positions you need to create plugin on category save which takes the posted json, compares with original json and performs the required operation.

Magento 2: How to create your own Patch File and apply it through composer

Magento releases new patches for it's framework from time to time. Here is a tutorial of how to create your own patch file in Magento. Although I personally am not a huge fan of patches, due to various drawbacks, there are desperate times when you need to apply a patch. I would suggest to use this approach as less as possible and instead opt going the standard magento way of versioned modules that store your changes. But, In case there are times when you are forced to create a patch, or just for self-knowledge on how it's done, you can follow below tutorial. STEP 1: In your magento root directory create a folder called "patches". STEP 2: Create a sub-directory with the name Namespace_Module for the module which you want to create a patch for. So the path will look like this: < >\patches\Namespace_Module STEP 3: Add your patch file in the directory you created in Step 2 of this tutorial. HOW TO CREATE A PATCH FILE: Create a backup of the ori...