/** * Hook into 'woocommerce_composite_show_composited_product_bundle' to show bundle type product content. * * @param WC_Product $product * @param string $component_id * @param WC_Product $composite * @return void */ public static function composite_show_product_bundle($product, $component_id, $composite) { if ($product->contains_sub()) { ?> <div class="woocommerce-error"><?php echo __('This item cannot be purchased at the moment.', 'woocommerce-product-bundles'); ?> </div><?php return false; } WC_PB_Compatibility::$compat_product = $product; WC_PB_Compatibility::$bundle_prefix = $component_id; $component_data = $composite->get_component_data($component_id); $quantity_min = $component_data['quantity_min']; $quantity_max = $component_data['quantity_max']; if ($product->sold_individually == 'yes') { $quantity_max = 1; $quantity_min = min($quantity_min, 1); } $custom_data = apply_filters('woocommerce_composited_product_custom_data', array(), $product, $component_id, $component_data, $composite); wc_get_template('composited-product/bundle-product.php', array('product' => $product, 'composite_id' => $composite->id, 'quantity_min' => $quantity_min, 'quantity_max' => $quantity_max, 'available_variations' => $product->get_available_bundle_variations(), 'attributes' => $product->get_bundle_variation_attributes(), 'selected_attributes' => $product->get_selected_bundle_variation_attributes(), 'custom_data' => $custom_data, 'bundle_price_data' => $product->get_bundle_price_data(), 'bundled_items' => $product->get_bundled_items(), 'component_id' => $component_id, 'composite_product' => $composite), false, WC_PB()->woo_bundles_plugin_path() . '/templates/'); WC_PB_Compatibility::$compat_product = ''; WC_PB_Compatibility::$bundle_prefix = ''; }