Skip to content

How to replace an existing product’s url with a new product

I am duplicating a product, disabling the old one and want to set the url of the new product to replace the old product. $duplicateParent = $this->productCopier->copy($oldproduct); $oldproduct->setUrlKey($existingUrlKey . ‘-old’); $oldproduct->setSku($existingSku . ‘-old’); $oldproduct->setVisibility(1); $duplicateParent->setUrlKey($existingUrlKey); $oldproduct->save(); $duplicateParent->save(); It’s throwing an… Read More »How to replace an existing product’s url with a new product

Magento 2.4.6 Opimize database tables

I’m using Magento 2.4.6, I want optimize the database, Some tables have large entries. report_viewed_product_aggregated_daily report_viewed_product_aggregated_monthly report_viewed_product_aggregated_yearly report_viewed_product_index What is the use of these tables? Can I truncate these tables from live site?