ok, i have do it the code for this ??
$packages_terms = array();
foreach ( WC()->cart->get_cart() as $item ) {
//here the taxonomy
$terms = get_the_terms( $item[ 'product_id' ], 'shop_vendor' );
if ( $item[ 'data' ]->needs_shipping() ) {
$packages_terms[ $terms[ 0 ]->name ][] = $item;
}
}
// Put inside packages
foreach ( $packages_terms as $term_name => $items ) {
$packages[ ] = array(
'contents' => $items,
'contents_cost' => array_sum( wp_list_pluck( $items, 'line_total' ) ),
'applied_coupons' => WC()->cart->applied_coupons,
'destination' => array(
'country' => WC()->customer->get_shipping_country(),
'state' => WC()->customer->get_shipping_state(),
'postcode' => WC()->customer->get_shipping_postcode(),
'city' => WC()->customer->get_shipping_city(),
'address' => WC()->customer->get_shipping_address(),
'address_2' => WC()->customer->get_shipping_address_2()
)
);
// Determine if 'ship_via' applies
$key = $item[ 'data' ]->get_shipping_class_id();
if ( $free_classes && in_array( $key, $free_classes ) ) {
$packages[ $term_name ][ 'ship_via' ] = array( 'free_shipping' );
} elseif ( count( $package_restrictions ) && isset( $package_restrictions[ $key ] ) ) {
$packages[ $term_name ][ 'ship_via' ] = $package_restrictions[ $key ];
}
}