5

I have two separate e-commerce platforms.

  1. A large, old system that drives all the orders and dispatch.
  2. An online store powered by WordPress / WooCommerce.

So far, we've managed to automate a lot of simple things like pulling orders from WP, and pushing updated stock levels to it.

One thing I cannot fathom, however, is when I create free_shipping method and set a minimum spend. Where is that stored in the DB?

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
Mongo0se
  • 173
  • 2
  • 11

1 Answers1

6

You can ask to yourself: Where do Wordpress plugins store their settings?

The answer is simply the wp_options table.

If your "Free shipping" Shipping method ID is free_shipping:10 you can use:

$free_shipping = get_option( 'woocommerce_free_shipping_10_settings' ); 
$min_amount    = $free_shipping['min_amount'];

To retrieve the array of data, where woocommerce_free_shipping_10_settings is the option_name.

The following SQL search query will retrieve all your "Free shipping" methods settings:

SELECT * FROM `wp_options` WHERE `option_name` LIKE 'woocommerce_free_shipping%' 
LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
  • And for shipping zone methods, there is the [woocommerce_shipping_zone_methods table](https://github.com/woocommerce/woocommerce/wiki/Database-Description#table-woocommerce_shipping_zone_methods). – clayRay Jul 10 '19 at 02:01