E-commerce Platforms
Magento 2 Allowed Memory exhausted error when compile code
you need to increase the memory_limit in php.ini
and as a quick solution you can use these commands directly in the command line
php -dmemory_limit=5G bin/magento setup:di:compile
and
php -dmemory_limit=5G bin/magento setup:static-content:deploy
another code for the composer update
php -dmemory_limit=5G composer.phar update
php -d memory_limit=-1 /usr/local/bin/composer update
Disable Smile-SA / Elasticsuite
We can disable Disable Smile-SA / Elasticsuite in Magento by executing this command
php bin/magento modeul:disable Smile_ElasticsuiteCore Smile_ElasticsuiteCatalog Smile_ElasticsuiteCatalogGraphQl Smile_ElasticsuiteCatalogRule Smile_ElasticsuiteCatalogOptimizer Smile_ElasticsuiteTracker Smile_ElasticsuiteThesaurus Smile_ElasticsuiteSwatches Smile_ElasticsuiteIndices Smile_ElasticsuiteVirtualCategory
to install the needed plugins you need to execute this command
Change the display time of exception message magento 2
To change the time please copy this file
vendor\magento\module-ui\view\frontend\web\js\view\messages.js
to your them to be in this path
app\design\frontend\{vendor}\{theme}\Magento_Ui\web\js\view\messages.js
then modify this function
Magento: Reindex everyday on specific time
You can add this to your code in order to reindex in UTC -5
0 5 * * * cd /home/{your-full-path}/public_html/ && php -f bin/magento indexer:reindex
How to fix Autocomplete template broken Porto Theme with Smile-SA elasticsuite
Create this file "default.xml" in your theme directory in this folder "{vendor}/{theme}Magento_Search/layout"
add this code in the file
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 )

Change the Order Reference to Number Reference
In order to change the Order Reference to Number Reference you need to extend the order.php class and override generateReference function
You should create a file called order.php in the folder /override/classes/order and paste the above code.
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