How to get Product Canonical Url by id Programmatically Magento 2?

Get Product Canonical URL in Magento using product id to see your current store product page Canonical URL.

Fetch Product Object by the id and use the method getUrlInStore() to retrieve URL.

Check given code to retrieve canonical URL, Continue reading “How to get Product Canonical Url by id Programmatically Magento 2?”

How to add Category Custom Layout Update XML file in Magento 2.3.4?

From Magento 2.3.4, Custom Layout Update Textarea removed from the admin panel category edit page, product edit page and cms edit page to remove the opportunity of Remote Code Execution (RCE). Replace Textarea with a selector.

Earlier you can add directly XML code snippet for the specific entity from the backend but from Magento 2.3.4 new feature was added. You need to create an XML file in your theme or module level and assign an XML file to the Custom Layout Update selector. Continue reading “How to add Category Custom Layout Update XML file in Magento 2.3.4?”

How to perform event action for Catalog Product after delete completed?

You can perform event action to successfully Product deleted in Magento 2 by the catalog event name catalog_product_delete_after_done. This is the perfect event for product delete observer.

If Magento is sync with a third party ERP system and wants to sync product data between two platforms, if product deleted in Magento and want to delete a product from the ERP, You can perform this action using Magento native Event catalog_product_delete_after_done. Continue reading “How to perform event action for Catalog Product after delete completed?”