Boxtal
static function get_weight_from_order($order) {
$total_weight = 0;
foreach( $order->get_items( 'line_item' ) as $item ) {
$product_id = ( $item['variation_id'] != 0 ? $item['variation_id'] : $item['product_id'] );
$product_weight=self::get_product_weight($product_id);
$total_weight += (int)$item['qty'] * (float)$product_weight;
}
return (float)$total_weight;
}static function get_weight_from_order($order) {
$total_weight = 0;
foreach( $order->get_items( 'line_item' ) as $item ) {
$product_id = ( $item['variation_id'] != 0 ? $item['variation_id'] : $item['product_id'] );
$product_weight=self::get_product_weight($product_id);
$product_weight = apply_filters( 'envoimoinscher_order_line_item_weight', $product_weight, $item );
$total_weight += (int)$item['qty'] * (float)$product_weight;
}
return (float)$total_weight;
}Last updated