Bulk Edit WooCommerce Coupons from Database using PhpMyadmin

Bulk Edit WooCommerce Coupons from Database using PhpMyadmin

bulk edit woocommerce coupon

The fastest & easiest way to edit WC Coupons is via database edit.

Having dozens of coupons in WooCommerce shop is very easy to manage. But when it comes to hundreds or more coupons it is going to be a big headache to manage them especially when you want to change or edit the coupon value in one go. So here is the best way so far to edit the coupon values in bulk.

Here we’re using Phpmyadmin for the database table queries. Some reference can be found in Stackoverflow answer here.

Edit WooCommerce Coupons in Database

  1. First things first, Backup the database.
  2. Log into Phpmyadmin and select the WP database.
  3. Identify the table prefix and coupon info that need to be updates based on the table below.
  4. Run the sql query.
  5. Do changes on the fly

 

Standard WC meta_key list:

meta_key meta_value
discount_type percentage/fixed_cart/fixed_product
coupon_amount numbers e.g: 0,1,2……..
free_shipping yes/no
expiry_date date based on your wp format. e.g: 2018-10-28
minimum_amount numbers e.g: 0,1,2…..
maximum_amount numbers e.g: 0,1,2…..
individual_use yes/no
exclude_sale_items yes/no
product_ids product ids e.g: 5674,8765,37265…….
exclude_product_ids product ids e.g: 5674,8765,37265…….
product_categories variable with cat ids e.g: a:3:{i:0;i:204;i:1;i:199;i:2;}
exclude_product_categories variable with cat ids e.g: a:3:{i:0;i:204;i:1;i:199;i:2;}
customer_email variable with user email e.g: a:1:{i:0;s:14:”email@mail.com”;}
usage_limit numbers, 0=unlimited.
usage_limit_per_user numbers, 0=unlimited.
usage_count numbers

In Phpmyadmin, click the “Query” tab and fill in the following in the query box.

SELECT * FROM `gozf_postmeta` WHERE `meta_key` = 'coupon_amount'

Change “gozf_postmeta” to your table prefix. Change the meta_key to the value that need to be updated.

***Do take note on the ` and ‘ symbol. Make sure they’re correct, otherwise it will return query error.

woocommerce coupon bulk edit

Once the query submitted, it will returns list of coupons ids with meta_key column required. To update or change the value, we can simply Double Click on each meta_value box and then insert the new value. To apply the changes, simply click anywhere outside the box.

We can also use the Check All options to do bulk change.

For 1000’s of coupons, we can also use the sql query method, provided the meta_id is known using the following query.

UPDATE `wp543`.`gozf_postmeta` SET `meta_value` = '1' WHERE `gozf_postmeta`.`meta_id` = 348652

If you have other better way to edit WooCommerce coupon data in bulk, please leave your comment below.

Share this post