/** * Display bundled product details templates. * * @param WC_Bundled_Item $bundled_item * @param WC_Product_Bundle $bundle * @return void */ function wc_bundles_bundled_item_product_details($bundled_item, $bundle) { if ($bundled_item->is_purchasable()) { $bundled_product = $bundled_item->product; $availability = $bundled_item->get_availability(); $bundle_fields_prefix = apply_filters('woocommerce_product_bundle_field_prefix', '', $bundle->id); $bundled_item->add_price_filters(); if ($bundled_item->is_optional()) { // Optional checkbox template. wc_get_template('single-product/bundled-item-optional.php', array('quantity' => $bundled_item->get_quantity(), 'bundled_item' => $bundled_item, 'bundle_fields_prefix' => $bundle_fields_prefix), false, WC_PB()->woo_bundles_plugin_path() . '/templates/'); } if ($bundled_product->product_type === 'simple' || $bundled_product->product_type === 'subscription') { // Simple Product template. wc_get_template('single-product/bundled-product-simple.php', array('bundled_product' => $bundled_product, 'bundled_item' => $bundled_item, 'bundle' => $bundle, 'bundle_fields_prefix' => $bundle_fields_prefix, 'availability' => $availability), false, WC_PB()->woo_bundles_plugin_path() . '/templates/'); } elseif ($bundled_product->product_type === 'variable' || $bundled_product->product_type === 'variable-subscription') { // Variable Product template. wc_get_template('single-product/bundled-product-variable.php', array('bundled_product' => $bundled_product, 'bundled_item' => $bundled_item, 'bundle' => $bundle, 'bundle_fields_prefix' => $bundle_fields_prefix, 'availability' => $availability, 'bundled_product_attributes' => $bundled_item->get_product_variation_attributes(), 'bundled_product_variations' => $bundled_item->get_product_variations(), 'bundled_product_selected_attributes' => $bundled_item->get_selected_product_variation_attributes()), false, WC_PB()->woo_bundles_plugin_path() . '/templates/'); } $bundled_item->remove_price_filters(); } else { echo __('Sorry, this item is not available at the moment.', 'woocommerce-product-bundles'); } }
/** * Load bundled items. * * @return void * @since 4.7.0 */ private function load_bundled_items() { global $woocommerce_bundles; foreach ($this->bundle_data as $bundled_item_id => $bundled_item_data) { $bundled_item = new WC_Bundled_Item($bundled_item_id, $this); if ($bundled_item->exists()) { $this->bundled_items[$bundled_item_id] = $bundled_item; } } }