WordPress at Your Fingertips
function is not described

WC_Shipping_Zone_Data_Store::get_methods() public WC 3.0.0

Get a list of shipping methods for a specific zone.

{} It's a method of the class: WC_Shipping_Zone_Data_Store{}

No Hooks.

Return

Array. Array of objects containing method_id, method_order, instance_id, is_enabled

Usage

$WC_Shipping_Zone_Data_Store = new WC_Shipping_Zone_Data_Store();
$WC_Shipping_Zone_Data_Store->get_methods( $zone_id, $enabled_only );
$zone_id(int) (required)
Zone ID.
$enabled_only(true|false) (required)
True to request enabled methods only.

Changelog

Since 3.0.0 Introduced.

Code of WC_Shipping_Zone_Data_Store::get_methods() WC 5.7.1

public function get_methods( $zone_id, $enabled_only ) {
	global $wpdb;

	if ( $enabled_only ) {
		$raw_methods_sql = "SELECT method_id, method_order, instance_id, is_enabled FROM {$wpdb->prefix}woocommerce_shipping_zone_methods WHERE zone_id = %d AND is_enabled = 1";
	} else {
		$raw_methods_sql = "SELECT method_id, method_order, instance_id, is_enabled FROM {$wpdb->prefix}woocommerce_shipping_zone_methods WHERE zone_id = %d";
	}

	return $wpdb->get_results( $wpdb->prepare( $raw_methods_sql, $zone_id ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
}