WC_Shipping_Flat_Rate::find_shipping_classes()
Finds and returns shipping classes and the products with said class.
Метод класса: WC_Shipping_Flat_Rate{}
Хуков нет.
Возвращает
Массив
.
Использование
$WC_Shipping_Flat_Rate = new WC_Shipping_Flat_Rate(); $WC_Shipping_Flat_Rate->find_shipping_classes( $package );
- $package(разное) (обязательный)
- Package of items from cart.
Код WC_Shipping_Flat_Rate::find_shipping_classes() WC Shipping Flat Rate::find shipping classes WC 9.3.3
public function find_shipping_classes( $package ) { $found_shipping_classes = array(); foreach ( $package['contents'] as $item_id => $values ) { if ( $values['data']->needs_shipping() ) { $found_class = $values['data']->get_shipping_class(); if ( ! isset( $found_shipping_classes[ $found_class ] ) ) { $found_shipping_classes[ $found_class ] = array(); } $found_shipping_classes[ $found_class ][ $item_id ] = $values; } } return $found_shipping_classes; }