It’s no secret that WooCommerce is one of the most popular eCommerce platforms on the web.
One of the things that makes WooCommerce so great is that it offers a ton of flexibility when it comes to managing your products and pricing.
In this article, we’re going to show you how to bulk update prices in WooCommerce.
There are a few different ways to bulk update prices in Woo Commerce.
1. The first way is to use the built-in WordPress bulk editor.
- To do this, go to your WordPress admin panel and click on Products » All Products.
- On the next page, you’ll see a list of all your products. Select the products that you want to update by checking the boxes next to their names.
- Once you’ve selected the products, select Edit from the Bulk Actions drop-down menu and click Apply.
- On the Edit screen, you can update The second way is by using a plugin like WPBulkEdit.
- This plugin allows you quickly edit product data in your WooCommerce store, including prices.
- To use WPBulkEdit, install and activate plugin on your WordPress site.
- Once activated go tousing WPBulkEdit oducts » WP Bulk Edit fromadmin panel.
2. The final way would be through code.
You could do this my updating simple product price or variations price programmatically using following code snippets:
// Updating Simple Product Price $product = wc_get_product( $product_id ); $product->set_price( $new_price ); // set new price here $product->save(); // Save changes
// Updating Variable Product Price (Variations) $product = wc_get_product( $product_id ); foreach($product->get_available_variations() as $key => $variation) { // get all available variations (prices) $variation = wc_get_product( $variation['variation_id'] ); // get variation object $variation->set_price( $new_price ); // set new price here $variation->save(); // Save changes }