WC_Shipping_Legacy_Flat_Rate::find_shipping_classes()
Finds and returns shipping classes and the products with said class.
Method of the class: WC_Shipping_Legacy_Flat_Rate{}
No Hooks.
Return
Array
.
Usage
$WC_Shipping_Legacy_Flat_Rate = new WC_Shipping_Legacy_Flat_Rate(); $WC_Shipping_Legacy_Flat_Rate->find_shipping_classes( $package );
- $package(mixed) (required)
- Package information.
WC_Shipping_Legacy_Flat_Rate::find_shipping_classes() WC Shipping Legacy Flat Rate::find shipping classes code WC 9.4.2
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; }