Magento 2 delete Meta Name Meta Title Meta Description ALL products
Please can someone let me know if its possible to delete the Meta Values for all products in my store
These were added during import and we want to remove them as we want to use extension to auto generate these values.
Is there anything that can be done via MYSQL to quickly remove all the entries for them.
I dont want to export all products and then update with blank it will take forever as there are 30000 + products
Hello @gt38er
You can set empty value for all meta info for all products by following approach :
1. Search Meta data attributes id from eav_attribute table.
2. Update value to null or empty string in value column after filtering with all attribute_id(s).
PS : Don't delete any row, just update value column.
Make sure you take backup of database before altering anything.
Also you can skip clean up and just check the behaviour of that extension for existing product meta data.
Hope it helps !
thank you for your kind reply,
please can you clarify what you mean
2. Update value to null or empty string in value column after filtering with all attribute_id(s).
can you show any screenshot? or link to anything similar please
Hi @gt38er
Magento already has a built in system for importing (create/update) products. Just go to System->Import/Export->Import and upload a csv file that looks like this:
sku, meta_title, meta_description SKU1,"Meta title for SKU1"," "
You can update description or other fields using uploading csv. It can help you to update whole products description.
Problem Solved? Please click on 'Kudos' & Accept as Solution!
hello @gt38er,
you can use the following SQL to delete meta_title & meta_description
for all products
UPDATE catalog_product_entity_varchar SET value = NULL WHERE attribute_id IN (SELECT attribute_id FROM eav_attribute WHERE attribute_code IN ( "meta_title", "meta_description" ) AND entity_type_id = (SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = "catalog_product"))
I hope it helps!
You can first check the attribute_id first by following query :
SELECT * FROM eav_attribute where attribute_code LIKE "%meta%";
Results :
https://www.awesomescreenshot.com/image/5414798/594ff792bcce17a06704dc70e1bfb03c
From here I got three attribute_id = 84,85,86 as entity_id = 4 for catalog_product;
then I checked if data is there or not by this command :
SELECT * FROM catalog_product_entity_varchar where attribute_id IN (84,85,86);
and then updated by below command :
update catalog_product_entity_varchar SET value = null where attribute_id IN (84,85,86);
Please take backup database before running update !
Thanks for the reply please can you let me know when i run from inside table eav_attribute
SELECT * FROM eav_attribute where attribute_code LIKE "%meta%";
I get output like this
SELECT `attribute_id`, `entity_type_id`, `attribute_code`, `attribute_model`, `backend_model`, `backend_type`, `backend_table`, `frontend_model`, `frontend_input`, `frontend_label`, `frontend_class`, `source_model`, `is_required`, `is_user_defined`, `default_value`, `is_unique`, `note` FROM `eav_attribute` WHERE 1
Also as per your screenshot why are there 2 output for each for example meta_title attribute_id 49 - entity_type_id = 3 and also attribute_id 84 - entity_type_id = 4
It's because we have meta data for Products and Categories too. so one is for products and other is for category.
You can check in your database which value is assigned for products :
SELECT * FROM entity_type_id;
Hope it helps !