/**
  * When a bundle is static-priced, the price of all bundled items is set to 0.
  * When the shipping mode is set to "bundled", all bundled items are marked as virtual when they are added to the cart.
  * Otherwise, the container itself is a virtual product in the first place.
  *
  * @param  array             $cart_item
  * @param  WC_Product_Bundle $bundle
  * @return array
  */
 private function set_bundled_cart_item($cart_item, $bundle)
 {
     $bundled_item_id = $cart_item['bundled_item_id'];
     $per_product_pricing = $bundle->is_priced_per_product();
     $per_product_shipping = $bundle->is_shipped_per_product();
     if (!$per_product_pricing) {
         $cart_item['data']->price = 0;
         if (isset($cart_item['data']->subscription_sign_up_fee)) {
             $cart_item['data']->subscription_sign_up_fee = 0;
         }
     } else {
         $discount = $cart_item['stamp'][$cart_item['bundled_item_id']]['discount'];
         if (!empty($discount) || has_filter('woocommerce_bundle_is_composited')) {
             $bundled_item = $bundle->get_bundled_item($bundled_item_id);
             $bundled_item->add_price_filters($bundled_item);
             $cart_item['data']->price = $cart_item['data']->get_price();
             unset($cart_item['data']->bundled_item);
             $bundled_item->remove_price_filters();
         }
     }
     if ($cart_item['data']->needs_shipping()) {
         if (false === apply_filters('woocommerce_bundled_item_shipped_individually', $per_product_shipping, $cart_item['data'], $bundled_item_id, $bundle)) {
             if (apply_filters('woocommerce_bundled_item_has_bundled_weight', false, $cart_item['data'], $bundled_item_id, $bundle)) {
                 $cart_item['data']->bundled_weight = $cart_item['data']->get_weight();
             }
             $cart_item['data']->bundled_value = $cart_item['data']->price;
             $cart_item['data']->virtual = 'yes';
         }
     }
     return apply_filters('woocommerce_bundled_cart_item', $cart_item, $bundle);
 }