Magento2
Power your online business with the most flexible and scalable ecommerce platform
How to use Private Content or Sections in Magento 2?
We will show here how we can display a private content in a full cached page, it is very useful if you want to display information per customer
Magento loads sections by AJAX request to /customer/section/load/ and caches loaded data in the browser local storage under the key mage-cache-storage. Magento tracks when some section is changed and load updated section automatically.
We will use this Vendor/Module as names
Display recently viewed products for NOT LOGGED CUSTOMERS in Magento 2
Go to Admin => Stores > Configuration > Catalog > Catalog > Recently Viewed/Compared Products select Yes to ( Synchronize widget products with backend storage )
Getting error when try to save shipping information for user using magento 2 api
Unable to save address. Please check input data.
It's a strange error we have it sometime, to solve it in some cases you execute this query
SELECT entity_id, customer_id FROM quote WHERE customer_id != 0 AND customer_is_guest = 1;
and then update the records by this query
UPDATE quote SET customer_is_guest = 0 WHERE customer_id != 0 AND customer_is_guest = 1;
reference url :
https://stackoverflow.com/a/58086757/4135373
Magento2 Hide Discount Code form Cart and Checkout Page
the best way is to work on your custom theme by modifying these files
/app/design/frontend/{Vendor}/{theme}/Magento_Checkout/layout/checkout_index_index.xml
Magento2- Remove plus sign from the configurable product attributes that have additional price
To do this we need to work on the design area it is the easiest way
firs Create new folder under your theme
Folder Name: Magento_ConfigurableProduct\web\js
Copy this file "configurable.js" from this path
vendor/magento/module-configurable-product/view/frontend/web/js/configurable.js
in the line 407 you need to modify this part
Magento2 use equal in email template
In this wiki we will find a way to use "==" equal in the email template, actually there is no equal in the email template itself but we can refer to a phtml file and pass a variable to it then use the if/equal in the phtml file to do this you can easily add this code to the template
in the below example we will check if the payment method is bank transfer then we will write something
Magento2 Some code paths
- Where does Magento Check the email frequency send
\vendor\magento\module-security\Model\SecurityChecker\Frequency.php
public function check($securityEventType, $accountReference = null, $longIp = null) { }
-
Use SMTP no authorization for Office 365 in Magento 2
First of all you need to install Mageplaza Extension , you can find it here
https://github.com/mageplaza/magento-2-smtp
after you create O365 SMTP connector that you may use as smtp server to allow sending out emails as group
you need to override this class
vendor\mageplaza\module-smtp\Model\Config\Source\Authentication.php
change value of None from '' into 'smtp'.
then go to the configuration and choose None and click on Save
that's it :)
Magento 2 get current category Id using registry
You need to use this in your constructer
/** * @var Magento\Framework\Registry */ private $registry;
public function __construct(\Magento\Framework\Registry $registry)
{ $this->registry = $registry; }
then you can get the current category by this code
$category = $this->registry->registry('current_category');