WC_Shipping_Zone_Data_Store::get_methods( int $zone_id, bool $enabled_only )
Get a list of shipping methods for a specific zone.
Description Description
Parameters Parameters
- $zone_id
-
(Required) Zone ID.
- $enabled_only
-
(Required) True to request enabled methods only.
Return Return
(array) Array of objects containing method_id, method_order, instance_id, is_enabled
Source Source
File: includes/data-stores/class-wc-shipping-zone-data-store.php
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 }
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |