The swatch attributes can be used on the category page, product page, and layered navigation. The swatches make the product attributes very attractive on the website and easy to choose for customers. For example, size, color, length, etc. In this blog, we get an idea of how to create a custom text swatch-type product attribute. […]
How to create custom Text Swatch product attribute using Data Patch in Magento 2
In this blog, we get an idea of how to create select and multiselect type product attributes. Following is a sample code example of a data patch to create a select type product attribute. You can get the full code example from our last blog: How to create custom product attribute using Data Patch in […]
As per our business solutions or client requirements, we need to create custom product attributes. There are 2 ways to create custom product attributes: 1. From Admin Admin > Stores > Attributes: Product > Add New Attribute 2. Programmatically We can create custom product attributes using the InstallData setup script as well as using Data […]
Usually, we can check whether a customer is logged in via the Customer Session (Magento\Customer\Model\Session) class. Sometimes when a full-page cache is enabled, the generic class will not work as per our expectation. So in that case we can use HttpContext (Magento\Framework\App\Http\Context) class to check whether a customer is logged in or not. HttpContext class […]
Custom Attributes are the attributes that we can add with customized sources of available data types. In short, we can add Custom Attributes not available in built-in Magento. The Customer and Catalog entities use EAV entities and CustomAttributesDataInterface defines getCustomAttributes() and setCustomAttributes() methods. In this blog, we are getting an idea of how we can […]
Declarative Schema in Magento 2
4 years ago
Declarative schema is a new concept introduced in Magento 2.3. It makes the smooth process of database schema operations with fewer coding and execution steps. Before Magento 2.3, the following script files are used in the Setup directory of the module to perform DB management: InstallSchema.php: runs script when module is installed to the setup […]
How to create custom module in Magento 2
4 years ago
The Magento module is a structural element that handles the flow of functionality. We can use a module for third-party module customization, override default Magento functionality, and implement new features. There are controller, block, model, etc, views directories to manage the business feature. There are two directories where you can place your modules, app/code, and […]
Magento 2 + CMS block create via Data Patch
4 years ago
It’s easy to create a Cms Block via admin, but when code is moved to another server or in some cases of data loss, might be a chance to lose that block, and is not recoverable. Creating a CMS Block via data patch is easy to use, it will create automatically blocks when the source […]
Magento 2 + CMS page create via Data Patch
4 years ago
It’s easy to create a Cms Page via admin, but when code is moved to another server or in some cases of data loss, might be a chance to lose that page, and is not recoverable. Creating a CMS Page via data patch is easy to use, it will create automatically pages when the source […]
Easy way to check whether customer logged in or not via customer Js component in phtml file. <div data-bind="scope: 'customer'"> <!-- ko if: customer().fullname --> Logged In customer <!-- /ko --> <!-- ko ifnot: customer().fullname --> Notlogged In customer <!-- /ko --> </div> <script type="text/x-magento-init"> { "*": { "Magento_Ui/js/core/app": { "components": { "customer": { "component": […]

