Automattic\WooCommerce\Internal\Admin
SiteHealth::has_legacy_shipping_methods_enabled
Determine whether any legacy shipping methods are enabled.
Method of the class: SiteHealth{}
No Hooks.
Returns
true|false.
Usage
// private - for code of main (parent) class only $result = $this->has_legacy_shipping_methods_enabled();
SiteHealth::has_legacy_shipping_methods_enabled() SiteHealth::has legacy shipping methods enabled code WC 11.0.0
private function has_legacy_shipping_methods_enabled() {
$legacy_methods = array( 'flat_rate', 'free_shipping', 'international_delivery', 'local_delivery', 'local_pickup' );
foreach ( $legacy_methods as $method ) {
$options = get_option( 'woocommerce_' . $method . '_settings' );
if ( $options && isset( $options['enabled'] ) && 'yes' === $options['enabled'] ) {
return true;
}
}
return false;
}