Need wordpress filter help

SpiderWeb

Active member
Trusted Uploader
Sep 23, 2020
183
166
43
I have around 15000 products for which "Product Brand" is not assigned. I created 2000 new products and have assigned "Product brand" to them.

I have only 1 "Product Brand" in entire woo-commerce store.

Is there anyway possible to update all products having "Product Brand" not assigned with custom code so as to save time doing it manually using default Bulk Edit in Woocommerce.
 

guguk

Well-known member
Jul 19, 2019
1,150
828
113
Ottoman Empire
I have around 15000 products for which "Product Brand" is not assigned. I created 2000 new products and have assigned "Product brand" to them.

I have only 1 "Product Brand" in entire woo-commerce store.

Is there anyway possible to update all products having "Product Brand" not assigned with custom code so as to save time doing it manually using default Bulk Edit in Woocommerce.
I think that most logical way to doing via "Bulk Edit" plugins with slow-mode (because it will be increase server CPU otherwise)
Or you can use wp-all import plugin to update that only this field may it faster than "bulk edit" plugin (I've no idea about comparing)

Last time you can do it with running SQL but it's not safest method rather than others. Because we dont know that "product-brand" is what? a variation like color, size? custom field? So, preparing SQL code a little bit hard, i guess.
 

chareen3

Active member
Trusted Uploader
Sep 4, 2018
107
213
43
Yes, it is possible to update the products in your WooCommerce store using a custom code. Here is a general outline of the steps you can follow to achieve this:

  1. Connect to your WooCommerce store's database using a MySQL client such as PHPMyAdmin or the MySQL command line.
  2. Use the following SQL query to update the products that have a blank value for the "Product Brand" field:
SQL:
UPDATE wp_posts SET post_excerpt = 'Brand Name' WHERE post_type = 'product' AND post_excerpt = ''


Replace "Brand Name" with the actual brand name you want to assign to the products.

  1. Run the query to update the products.
Keep in mind that this is just a general outline and you will need to adjust the details to match your specific setup. It is also a good idea to make a backup of your database before making any changes.

You can use a WordPress plugin such as WP All Import to import the product data from a CSV file and update the products in bulk. This may be easier and less error-prone than writing a custom code.
 

SpiderWeb

Active member
Trusted Uploader
Sep 23, 2020
183
166
43
Yes, it is possible to update the products in your WooCommerce store using a custom code. Here is a general outline of the steps you can follow to achieve this:

  1. Connect to your WooCommerce store's database using a MySQL client such as PHPMyAdmin or the MySQL command line.
  2. Use the following SQL query to update the products that have a blank value for the "Product Brand" field:
SQL:
UPDATE wp_posts SET post_excerpt = 'Brand Name' WHERE post_type = 'product' AND post_excerpt = ''


Replace "Brand Name" with the actual brand name you want to assign to the products.

  1. Run the query to update the products.
Keep in mind that this is just a general outline and you will need to adjust the details to match your specific setup. It is also a good idea to make a backup of your database before making any changes.

You can use a WordPress plugin such as WP All Import to import the product data from a CSV file and update the products in bulk. This may be easier and less error-prone than writing a custom code.

Thanks for response. But isnt the post_excerpt is Short Description?
 

SpiderWeb

Active member
Trusted Uploader
Sep 23, 2020
183
166
43
I think that most logical way to doing via "Bulk Edit" plugins with slow-mode (because it will be increase server CPU otherwise)
Or you can use wp-all import plugin to update that only this field may it faster than "bulk edit" plugin (I've no idea about comparing)

Last time you can do it with running SQL but it's not safest method rather than others. Because we dont know that "product-brand" is what? a variation like color, size? custom field? So, preparing SQL code a little bit hard, i guess.
Yes, as products are huge in number... I may need to spare 2-3 days only to do this daunting task... :-(
 

guguk

Well-known member
Jul 19, 2019
1,150
828
113
Ottoman Empire
Yes, as products are huge in number... I may need to spare 2-3 days only to do this daunting task... :-(
Yes thats true but as I said before the way is more easiest and safest way I think. Otherwise you need audit database and find "product brand" belonged which row and create SQL query for that. If I were you I would prefer to make this by "wp all import" plugin which is more faster way.
 
  • Like
Reactions: chareen3

About us

  • Our community has been around for many years and pride ourselves on offering unbiased, critical discussion among people of all different backgrounds. We are working every day to make sure our community is one of the best.

Quick Navigation

User Menu