WC PHP obtiene métodos de envío
function prefix_get_available_shipping_methods(){
if ( ! class_exists( 'WC_Shipping_Zones' ) ) {
return array();
}
$zones = WC_Shipping_Zones::get_zones();
if ( ! is_array( $zones ) ) {
return array();
}
$shipping_methods = array_column( $zones, 'shipping_methods' );
$flatten = array_merge( ...$shipping_methods );
$normalized_shipping_methods = array();
foreach ( $flatten as $key => $class ) {
$normalized_shipping_methods[ $class->id ] = $class->method_title;
}
return $normalized_shipping_methods;
}
Weary Wildebeest