Category: Magento
Uses of checkout_before event in Magento
The “checkout_before” event is triggered just before the checkout process starts in Magento. It allows you to perform custom actions or modifications before the customer proceeds to the checkout. Some common use cases for the “checkout_before” event include: Validating or modifying cart items based on specific conditions or requirements. Applying custom pricing rules or discounts… Continue reading Uses of checkout_before event in Magento
How to create the customfield for product?
Login to Magento Admin>Store>Attributes>Product On the Product Attributes page, you can see by default that Magento gives us pre-defined attributes. Let me create a new attribute. Click on Add New Attribute Now we need to fill out details in the New Product Attribute and then Save. Let’s explain the fields: Default Label:Label text attributes that recognize… Continue reading How to create the customfield for product?
How to get Magento 2 customer group ID
To get logged in customer group id directly in phtml without using Dependency Injection, You can use the object manager to get group id in your phtml file. Using Dependency Injection app/code/Vendor/Module/Block/CustomBlock.php Now, you can use the functions in your phtml file as follows. <?php $customer= $block->getLayout()->createBlock(‘JJ\LoggedOut\Block\CustomerGroupId’); $group = $customer->getCustomerGroupId();?>
Slick carousel – force slides to have the same height
Add a couple of CSS styles and it will be ready: .slick-track{display: flex !important;} .slick-slide{height: inherit !important;}
How to connect a css to an xml in magento
The reason why <css src=”css/list.css” rel=”stylesheet” type=”text/css” /> did not work is that it is not a valid syntax in Magento 2 XML layout files. In Magento 2, the <css> tag is a custom XML tag specifically designed to include CSS files within the context of the Magento framework. It handles various functionalities, such as… Continue reading How to connect a css to an xml in magento
Magento 2: How to save form data to sales_order_item table from .phtml file of adminhtml in magento 2?
This can be done with a ajax controller[Vendor]/[module]/view/adminhtml/templates/order/view/tab/info.phtml [Vendor]/[module]/Controller/Adminhtml/Test/Save.phpon the controller [Vendor]/[module]/view/adminhtml/layout/routes.xml [Vendor]/[module]/view/adminhtml/layout/sales_order_view.xml
Method to Show Address Fields in Registration Form in Magento 2
To show the address fields in the registration form Add below code in your customer_account_create.xml file This will the address fields on the registration form
Magento 2 Pre-order and Backorder
A pre-order is used for the products that haven’t been released yet. A backorder option is available for items that are out-of-stock, but have been in stock lately. Magento doesn’t have a pre-order feature by default. So to make it work on your website, you need either an extension for that or a customization. To… Continue reading Magento 2 Pre-order and Backorder
Backorder Functionality-Magento
Backorders in Magento 2 Backorders functionality is supported by Magento 2 out-of-the-box. Go to Stores – Configuration – Catalog – Inventory – Product Stock Options tab. In the ‘Backorders’ section select the necessary option: No backorders disables backorders in your store; Allow Qty Below 0 shows the product as In Stock even when the product reaches qty = 0;… Continue reading Backorder Functionality-Magento