2014-10-30 19:58:19 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Class WC_Helper_Shipping.
|
2014-10-30 19:58:19 +00:00
|
|
|
*
|
2015-11-03 13:31:20 +00:00
|
|
|
* This helper class should ONLY be used for unit tests!.
|
2014-10-30 19:58:19 +00:00
|
|
|
*/
|
|
|
|
class WC_Helper_Shipping {
|
|
|
|
|
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Create a simple flat rate at the cost of 10.
|
2014-10-30 19:58:19 +00:00
|
|
|
*
|
|
|
|
* @since 2.3
|
|
|
|
*/
|
|
|
|
public static function create_simple_flat_rate() {
|
|
|
|
$flat_rate_settings = array(
|
2015-07-09 02:40:29 +00:00
|
|
|
'enabled' => 'yes',
|
|
|
|
'title' => 'Flat Rate',
|
|
|
|
'availability' => 'all',
|
|
|
|
'countries' => '',
|
|
|
|
'tax_status' => 'taxable',
|
|
|
|
'cost' => '10'
|
2014-10-30 19:58:19 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
update_option( 'woocommerce_flat_rate_settings', $flat_rate_settings );
|
|
|
|
update_option( 'woocommerce_flat_rate', array() );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Delete the simple flat rate.
|
2014-10-30 19:58:19 +00:00
|
|
|
*
|
|
|
|
* @since 2.3
|
|
|
|
*/
|
|
|
|
public static function delete_simple_flat_rate() {
|
|
|
|
delete_option( 'woocommerce_flat_rate_settings' );
|
|
|
|
delete_option( 'woocommerce_flat_rate' );
|
|
|
|
}
|
|
|
|
}
|