How to Add Product To Cart With Custom Price in Magento 2

Steps to Add Product To Cart With Custom Price in Magento 2 Step 1: First, create a file “events.xml” at the below-given path. appcodeVendorExtensionetcfrontendevents.xml Now add the below code Step 2: Now, we need one more file named “Customprice.php” that overrides our price. Go to the below path appcodeVendorExtensionObserverCustomprice.php And finally, add the code as mentioned below, <?php namespace VendorExtensionObserver; use… Continue reading How to Add Product To Cart With Custom Price in Magento 2

Published
Categorized as Magento

How To Change Welcome Message In Magento 2

Steps to Change Welcome Message In Magento 2: Login to the Admin panel Navigate to Content > Design > Configuration Edit the store view for which you want to change the default welcome message in the Magento 2 store Expand the Header section Input your custom welcome message in the Welcome Text field Save the configuration

Published
Categorized as Magento

DB schema method in Magento2

DB schema method is used to create tables or columns inside a table. create dbschema.xml inside app/code/vendor/module/etc/ It will create a table named declarative_table. Thank you.

Published
Categorized as Magento

How do call the quote subtotal inside a custom shipping method?

To call the quote total inside a custom shipping method On the collect function public function collect(         \Magento\Quote\Model\Quote\Address\Total $total     )     { parent::collect($quote, $shippingAssignment, $total); $orderTotal = $total->getSubtotal(); } Thank you.

Published
Categorized as Magento

Block IP or bots in the Cloudways server

Block the IP on Htaccess file <Limit GET POST>order allow,denydeny from 46.228.47.114deny from 46.225.88.5allow from all</Limit> Block bots using the Htacess file with name RewriteCond %{HTTP_USER_AGENT} Mj12bot [NC]RewriteCond %{HTTP_USER_AGENT} Dotbot [NC] Thank you.

Published
Categorized as Magento

How to create new credentials for Magento admin.

create a new admin user. bin/magento admin:user:create –admin-user=admin –admin-password=newpass123 –admin-email=admin@example.com –admin-firstname=John –admin-lastname=Doe Clear Cache: bin/magento cache:clean bin/magento admin:user:create –admin-user=admin12 –admin-password=admin@12 –admin-email=admin@example.com –admin-firstname=Jerin –admin-lastname=m

Published
Categorized as Magento