{"id":5493296,"date":"2014-11-18T21:14:20","date_gmt":"2014-11-18T21:14:20","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/plugin-woocommerce-product-bundle-remove-price-range\/"},"modified":"2016-08-22T12:42:31","modified_gmt":"2016-08-22T12:42:31","slug":"plugin-woocommerce-product-bundle-remove-price-range","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/plugin-woocommerce-product-bundle-remove-price-range\/","title":{"rendered":"[Plugin: Woocommerce product Bundle] Remove price range"},"content":{"rendered":"<p>Hi, I would like some help with this plugin. Before installing it I had removed the price range using some code in functions.php. Now that I have installed this new plugin is not working anymore. I think I have to change something of the next code, but I am pretty newbie with this, can anyone help me? I just want to change the price range to &#8220;From: 99,99&#8221;<\/p>\n<pre><code>&lt;?php\n\/**\n * Product Bundle Class\n *\n * @class \tWC_Product_Bundle\n * @version 4.1.1\n *\/\n\nif ( ! defined( &#039;ABSPATH&#039; ) ) exit; \/\/ Exit if accessed directly\n\nclass WC_Product_Bundle extends WC_Product {\n\n\tvar $bundle_data;\n\n\tvar $bundled_products;\n\n\tvar $min_price;\n\tvar $max_price;\n\n\tvar $min_bundle_price;\n\tvar $max_bundle_price;\n\tvar $min_bundle_regular_price;\n\tvar $max_bundle_regular_price;\n\n\tvar $min_bundle_price_excl_tax;\n\tvar $min_bundle_price_incl_tax;\n\n\tvar $bundle_attributes;\n\tvar $available_bundle_variations;\n\tvar $selected_bundle_attributes;\n\n\tvar $has_filters;\n\tvar $filtered_variation_attributes = array();\n\n\tvar $bundled_item_quantities = array();\n\tvar $bundled_item_discounts = array();\n\n\tvar $per_product_pricing_active;\n\tvar $per_product_shipping_active;\n\n\tvar $all_items_sold_individually;\n\tvar $all_items_in_stock;\n\tvar $has_items_on_backorder;\n\n\tvar $on_sale;\n\n\tvar $bundle_price_data;\n\n\tvar $bundle_availability_data = array();\n\n\tvar $contains_nyp;\n\n\tvar $processing_item_id;\n\n\tvar $item_id_for_price_filter;\n\n\tvar $enable_bundle_transients;\n\n\tvar $microdata_display = false;\n\n\tfunction __construct( $bundle ) {\n\n\t\tglobal $woocommerce_bundles, $woocommerce_bundle_helpers;\n\n\t\t$this-&gt;product_type = &#039;bundle&#039;;\n\n\t\tparent::__construct( $bundle );\n\n\t\t$this-&gt;bundle_data = maybe_unserialize( get_post_meta( $this-&gt;id, &#039;_bundle_data&#039;, true ) );\n\n\t\t$bundled_item_ids = maybe_unserialize( get_post_meta( $this-&gt;id, &#039;_bundled_ids&#039;, true ) );\n\n\t\tif ( empty( $this-&gt;bundle_data ) &amp;&amp; ! empty( $bundled_item_ids ) )\n\t\t\t$this-&gt;bundle_data = $woocommerce_bundles-&gt;serialize_bundle_meta( $this-&gt;id );\n\n\t\t$this-&gt;has_filters \t= false;\n\n\t\t$this-&gt;contains_nyp = false;\n\t\t$this-&gt;on_sale \t\t= false;\n\n\t\t$this-&gt;all_items_sold_individually \t= true;\n\t\t$this-&gt;all_items_in_stock\t\t\t= true;\n\t\t$this-&gt;has_items_on_backorder\t\t= false;\n\n\t\tif ( ! empty( $this-&gt;bundle_data ) ) {\n\t\t\tforeach( $this-&gt;bundle_data as $bundled_item_id =&gt; $bundled_item_data ) {\n\n\t\t\t\t\/\/ Store &#039;variation filtering&#039; boolean variables\n\t\t\t\tif ( isset( $bundled_item_data[ &#039;filter_variations&#039; ] ) &amp;&amp; $bundled_item_data[ &#039;filter_variations&#039; ] == &#039;yes&#039; )\n\t\t\t\t\t$this-&gt;has_filters = true;\n\n\t\t\t\t\/\/ Store bundled item quantities\n\t\t\t\t$this-&gt;bundled_item_quantities[ $bundled_item_id ] = ( int ) $bundled_item_data[ &#039;bundle_quantity&#039; ];\n\n\t\t\t\t\/\/ Store bundled item discounts\n\t\t\t\t$this-&gt;bundled_item_discounts[ $bundled_item_id ] = $bundled_item_data[ &#039;bundle_discount&#039; ];\n\t\t\t}\n\t\t}\n\n\t\tif ( $this-&gt;has_filters ) {\n\n\t\t\t\/\/ create array of attributes based on active variations\n\n\t\t\tforeach ( $this-&gt;bundle_data as $item_id =&gt; $bundled_item_data ) {\n\n\t\t\t\tif ( ! isset( $bundled_item_data[ &#039;filter_variations&#039; ] ) || $bundled_item_data[ &#039;filter_variations&#039; ] == &#039;no&#039; )\n\t\t\t\t\tcontinue;\n\n\t\t\t\t$allowed_variations = $bundled_item_data[ &#039;allowed_variations&#039; ];\n\n\t\t\t\t$product_id = $bundled_item_data[ &#039;product_id&#039; ];\n\n\t\t\t\t$attributes = ( array ) maybe_unserialize( get_post_meta( $product_id, &#039;_product_attributes&#039;, true ) );\n\n\t\t\t\t\/\/ filtered variation attributes (stores attributes of active variations)\n\t\t\t\t$filtered_attributes = array();\n\n\t\t\t\t$this-&gt;filtered_variation_attributes[ $item_id ] = array();\n\n\t\t\t\t\/\/ make array of active variation attributes\n\t\t\t\tforeach ( $allowed_variations as $allowed_variation_id ) {\n\n\t\t\t\t\t$description = &#039;&#039;;\n\n\t\t\t\t\t$variation_data = get_post_meta( $allowed_variation_id );\n\n\t\t\t\t\tforeach ( $attributes as $attribute ) {\n\n\t\t\t\t\t\t\/\/ Only deal with attributes that are variations\n\t\t\t\t\t\tif ( ! $attribute[ &#039;is_variation&#039; ] )\n\t\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t\t\/\/ Get current value for variation (if set)\n\t\t\t\t\t\t$variation_selected_value = isset( $variation_data[ &#039;attribute_&#039; . sanitize_title( $attribute[ &#039;name&#039; ] ) ][0] ) ? $variation_data[ &#039;attribute_&#039; . sanitize_title( $attribute[ &#039;name&#039; ] ) ][0] : &#039;&#039;;\n\n\t\t\t\t\t\t\/\/ Get terms for attribute taxonomy or value if its a custom attribute\n\t\t\t\t\t\tif ( $attribute[ &#039;is_taxonomy&#039; ] ) {\n\n\t\t\t\t\t\t\t$post_terms = wp_get_post_terms( $product_id, $attribute[ &#039;name&#039; ] );\n\n\t\t\t\t\t\t\tforeach ( $post_terms as $term ) {\n\n\t\t\t\t\t\t\t\tif ( $variation_selected_value == $term-&gt;slug || $variation_selected_value == &#039;&#039; ) {\n\n\t\t\t\t\t\t\t\t\tif ( $variation_selected_value == &#039;&#039; )\n\t\t\t\t\t\t\t\t\t\t$description = &#039;Any&#039;;\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\t$description = $term-&gt;name;\n\n\t\t\t\t\t\t\t\t\tif ( ! isset( $filtered_attributes[ $attribute[ &#039;name&#039; ] ] ) ) {\n\n\t\t\t\t\t\t\t\t\t\t$filtered_attributes[ $attribute[ &#039;name&#039; ] ][ &#039;descriptions&#039; ][] \t= $description;\n\t\t\t\t\t\t\t\t\t\t$filtered_attributes[ $attribute[ &#039;name&#039;] ][&#039;slugs&#039; ][] \t\t\t= sanitize_title( $description );\n\n\t\t\t\t\t\t\t\t\t} elseif ( ! in_array( $description, $filtered_attributes[ $attribute[ &#039;name&#039; ] ][ &#039;descriptions&#039; ] ) ) {\n\n\t\t\t\t\t\t\t\t\t\t$filtered_attributes[ $attribute[ &#039;name&#039; ] ][ &#039;descriptions&#039; ][] \t= $description;\n\t\t\t\t\t\t\t\t\t\t$filtered_attributes[ $attribute[ &#039;name&#039; ] ][ &#039;slugs&#039; ][] \t\t\t= sanitize_title( $description );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t$options = array_map( &#039;trim&#039;, explode( &#039;|&#039;, $attribute[ &#039;value&#039; ] ) );\n\n\t\t\t\t\t\t\tforeach ( $options as $option ) {\n\n\t\t\t\t\t\t\t\tif ( sanitize_title( $variation_selected_value ) == sanitize_title( $option ) || $variation_selected_value == &#039;&#039; ) {\n\n\t\t\t\t\t\t\t\t\tif( $variation_selected_value == &#039;&#039; )\n\t\t\t\t\t\t\t\t\t\t$description = &#039;Any&#039;;\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\t$description = $option;\n\n\t\t\t\t\t\t\t\t\tif ( ! isset( $filtered_attributes[ $attribute[&#039;name&#039;] ] ) ) {\n\n\t\t\t\t\t\t\t\t\t\t$filtered_attributes[ $attribute[ &#039;name&#039; ] ][ &#039;descriptions&#039; ][] \t= $description;\n\t\t\t\t\t\t\t\t\t\t$filtered_attributes[ $attribute[ &#039;name&#039; ] ][ &#039;slugs&#039; ][] \t\t\t= sanitize_title( $description );\n\n\t\t\t\t\t\t\t\t\t} elseif ( ! in_array( $description, $filtered_attributes[ $attribute[ &#039;name&#039; ] ][ &#039;descriptions&#039; ] ) ) {\n\n\t\t\t\t\t\t\t\t\t\t$filtered_attributes[ $attribute[ &#039;name&#039; ] ][ &#039;descriptions&#039; ][] \t= $description;\n\t\t\t\t\t\t\t\t\t\t$filtered_attributes[ $attribute[ &#039;name&#039; ] ][ &#039;slugs&#039; ][] \t\t\t= sanitize_title( $description );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\t\/\/ clean up product attributes\n\t\t\t        foreach ( $attributes as $attribute ) {\n\n\t\t\t            if ( ! $attribute[ &#039;is_variation&#039; ] )\n\t\t\t            \tcontinue;\n\n\t\t\t\t\t\tif ( array_key_exists( $attribute[ &#039;name&#039; ], $filtered_attributes ) &amp;&amp; !in_array( &#039;Any&#039;, $filtered_attributes[ $attribute[ &#039;name&#039; ] ][ &#039;descriptions&#039; ] ) )\n\t\t\t\t\t\t\t$this-&gt;filtered_variation_attributes[ $item_id ][ $attribute[ &#039;name&#039; ] ] = $filtered_attributes[ $attribute[ &#039;name&#039; ] ];\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t$this-&gt;per_product_pricing_active \t= ( get_post_meta( $this-&gt;id, &#039;_per_product_pricing_active&#039;, true ) == &#039;yes&#039; ) ? true : false;\n\t\t$this-&gt;per_product_shipping_active \t= ( get_post_meta( $this-&gt;id, &#039;_per_product_shipping_active&#039;, true ) == &#039;yes&#039; ) ? true : false;\n\n\t\t$this-&gt;enable_bundle_transients = get_post_meta( $this-&gt;id, &#039;enable_bundle_transients&#039;, true ) == &#039;yes&#039; ? true : false;\n\n\t\t$this-&gt;min_price = get_post_meta( $this-&gt;id, &#039;_min_bundle_price&#039;, true );\n\t\t$this-&gt;max_price = get_post_meta( $this-&gt;id, &#039;_max_bundle_price&#039;, true );\n\n\t\t$product_price = get_post_meta( $this-&gt;id, &#039;_price&#039;, true );\n\n\t\tif ( ! empty( $this-&gt;bundle_data ) ) {\n\n\t\t\t$this-&gt;load_bundle_data();\n\n\t\t\tif ( $this-&gt;per_product_pricing_active ) {\n\n\t\t\t\t$this-&gt;price = 0;\n\n\t\t\t\tif ( $this-&gt;contains_nyp )\n\t\t\t\t\t$this-&gt;max_bundle_price = 100000000.0;\n\n\t\t\t} else {\n\n\t\t\t\tif ( class_exists( &#039;WC_Name_Your_Price_Helpers&#039; ) &amp;&amp; WC_Name_Your_Price_Helpers::is_nyp( $this ) ) {\n\t\t\t\t\t$this-&gt;min_bundle_price = get_post_meta( $this-&gt;id, &#039;_min_price&#039;, true );\n\t\t\t\t\t$this-&gt;max_bundle_price = 100000000.0;\n\t\t\t\t} else {\n\t\t\t\t\t$this-&gt;min_bundle_price = $this-&gt;max_bundle_price = $this-&gt;get_price();\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( $this-&gt;min_price != $this-&gt;min_bundle_price )\n\t\t\t\tupdate_post_meta( $this-&gt;id, &#039;_min_bundle_price&#039;, $this-&gt;min_bundle_price );\n\n\t\t\tif ( $this-&gt;max_price != $this-&gt;max_bundle_price )\n\t\t\t\tupdate_post_meta( $this-&gt;id, &#039;_max_bundle_price&#039;, $this-&gt;max_bundle_price );\n\n\t\t\tif ( $product_price != $this-&gt;min_bundle_price )\n\t\t\t\tupdate_post_meta( $this-&gt;id, &#039;_price&#039;, $this-&gt;min_bundle_price );\n\n\t\t}\n\n\t}\n\n\tfunction load_bundle_data() {\n\n\t\tglobal $woocommerce_bundles, $woocommerce_bundle_helpers;\n\n\t\t\/\/ stores bundle pricing strategy info and price table\n\t\t$this-&gt;bundle_price_data = array();\n\n\t\t$this-&gt;bundle_price_data[ &#039;currency_symbol&#039; ] \t\t\t\t\t= get_woocommerce_currency_symbol();\n\t\t$this-&gt;bundle_price_data[ &#039;woocommerce_price_num_decimals&#039; ] \t= ( int ) get_option( &#039;woocommerce_price_num_decimals&#039; );\n\t\t$this-&gt;bundle_price_data[ &#039;woocommerce_currency_pos&#039; ] \t\t\t= get_option( &#039;woocommerce_currency_pos&#039; );\n\t\t$this-&gt;bundle_price_data[ &#039;woocommerce_price_decimal_sep&#039; ] \t= stripslashes( get_option( &#039;woocommerce_price_decimal_sep&#039; ) );\n\t\t$this-&gt;bundle_price_data[ &#039;woocommerce_price_thousand_sep&#039; ] \t= stripslashes( get_option( &#039;woocommerce_price_thousand_sep&#039; ) );\n\t\t$this-&gt;bundle_price_data[ &#039;woocommerce_price_trim_zeros&#039; ] \t\t= false == apply_filters( &#039;woocommerce_price_trim_zeros&#039;, false ) ? &#039;no&#039; : &#039;yes&#039;;\n\n\t\t$this-&gt;bundle_price_data[ &#039;total_description&#039; ] \t\t= __( &#039;Total&#039;, &#039;woo-bundles&#039; ) . &#039;: &#039;;\n\n\t\t$this-&gt;bundle_price_data[ &#039;partially_out_of_stock&#039; ] \t= __( &#039;Out of stock&#039;, &#039;woo-bundles&#039; );\n\t\t$this-&gt;bundle_price_data[ &#039;partially_on_backorder&#039; ] \t= __( &#039;Available on backorder&#039;, &#039;woo-bundles&#039; );\n\n\t\t$this-&gt;bundle_price_data[ &#039;free&#039; ] = __( &#039;Free!&#039;, &#039;woocommerce&#039; );\n\n\t\t$this-&gt;bundle_price_data[ &#039;per_product_pricing&#039; ] = $this-&gt;per_product_pricing_active;\n\t\t$this-&gt;bundle_price_data[ &#039;prices&#039; ] = array();\n\t\t$this-&gt;bundle_price_data[ &#039;regular_prices&#039; ] = array();\n\t\t$this-&gt;bundle_price_data[ &#039;total&#039; ] = $this-&gt;get_price() == &#039;&#039; ? -1 : $woocommerce_bundle_helpers-&gt;get_bundled_product_price( $this, $this-&gt;get_price() );\n\t\t$this-&gt;bundle_price_data[ &#039;regular_total&#039; ] = $woocommerce_bundle_helpers-&gt;get_bundled_product_price( $this, $this-&gt;get_regular_price() );\n\n\t\t$this-&gt;bundle_attributes = array();\n\t\t$this-&gt;available_bundle_variations = array();\n\t\t$this-&gt;selected_bundle_attributes = array();\n\t\t$this-&gt;bundled_products = array();\n\n\t\t$this-&gt;min_bundle_price = &#039;&#039;;\n\t\t$this-&gt;max_bundle_price = &#039;&#039;;\n\t\t$this-&gt;min_bundle_regular_price = &#039;&#039;;\n\t\t$this-&gt;max_bundle_regular_price = &#039;&#039;;\n\n\t\t$this-&gt;min_bundle_price_excl_tax = &#039;&#039;;\n\t\t$this-&gt;min_bundle_price_incl_tax = &#039;&#039;;\n\n\t\tforeach ( $this-&gt;bundle_data as $bundled_item_id =&gt; $bundled_item_data ) {\n\n\t\t\t$this-&gt;processing_item_id = $bundled_item_id;\n\n\t\t\t\/\/ remove suffix\n\t\t\t$product_id = $bundled_item_data[ &#039;product_id&#039; ];\n\n\t\t\t$bundled_product = get_product( $product_id );\n\n\t\t\tif ( ! $bundled_product || ! $bundled_product-&gt;is_purchasable() )\n\t\t\t\tcontinue;\n\n\t\t\t$this-&gt;bundled_products[ $bundled_item_id ] = $bundled_product;\n\n\t\t\tif ( $bundled_product-&gt;product_type == &#039;simple&#039; ) {\n\n\t\t\t\tif ( ! $bundled_product-&gt;is_sold_individually() )\n\t\t\t\t\t$this-&gt;all_items_sold_individually = false;\n\n\t\t\t\t$this-&gt;bundle_availability_data[ $bundled_item_id ] = $woocommerce_bundle_helpers-&gt;get_bundled_product_availability( $bundled_product, $this-&gt;bundled_item_quantities[ $bundled_item_id ] );\n\n\t\t\t\tif ( $this-&gt;bundle_availability_data[ $bundled_item_id ][ &#039;class&#039; ] == &#039;out-of-stock&#039; ) {\n\t\t\t\t\t$this-&gt;all_items_in_stock = false;\n\t\t\t\t}\n\n\t\t\t\tif ( $this-&gt;bundle_availability_data[ $bundled_item_id ][ &#039;class&#039; ] == &#039;available-on-backorder&#039; ) {\n\t\t\t\t\t$this-&gt;has_items_on_backorder = true;\n\t\t\t\t}\n\n\t\t\t\t$this-&gt;add_bundled_product_get_price_filter( $bundled_item_id );\n\n\t\t\t\t$product_regular_price \t= $woocommerce_bundle_helpers-&gt;get_bundled_regular_product_price( $bundled_product );\n\t\t\t\t$product_price \t\t\t= $bundled_product-&gt;get_price();\n\n\t\t\t\t$this-&gt;remove_bundled_product_get_price_filter( $bundled_item_id );\n\n\t\t\t\t\/\/ Name your price support\n\t\t\t\tif ( class_exists( &#039;WC_Name_Your_Price_Helpers&#039; ) &amp;&amp; WC_Name_Your_Price_Helpers::is_nyp( $product_id ) ) {\n\n\t\t\t\t\t$product_price = $product_regular_price = WC_Name_Your_Price_Helpers::get_minimum_price( $product_id ) ? WC_Name_Your_Price_Helpers::get_minimum_price( $product_id ) : 0;\n\n\t\t\t\t\t$this-&gt;contains_nyp = true;\n\n\t\t\t\t}\n\n\t\t\t\t$product_regular_price = $woocommerce_bundle_helpers-&gt;get_bundled_product_price( $bundled_product, $product_regular_price );\n\t\t\t\t$bundled_product_price = $woocommerce_bundle_helpers-&gt;get_bundled_product_price( $bundled_product, $product_price );\n\n\t\t\t\tif ( $product_regular_price &gt; $bundled_product_price )\n\t\t\t\t\t$this-&gt;on_sale = true;\n\n\t\t\t\t\/\/ price for simple products gets stored now, for variable products jquery gets the job done\n\t\t\t\t$this-&gt;bundle_price_data[ &#039;prices&#039; ][ $bundled_product-&gt;id ] \t\t\t= $bundled_product_price;\n\t\t\t\t$this-&gt;bundle_price_data[ &#039;regular_prices&#039; ][ $bundled_product-&gt;id ] \t= $product_regular_price;\n\n\t\t\t\t\/\/ no variation data to load - product is simple\n\t\t\t\t$this-&gt;min_bundle_price \t\t= $this-&gt;min_bundle_price + $this-&gt;bundled_item_quantities[ $bundled_item_id ] * $bundled_product_price;\n\t\t\t\t$this-&gt;min_bundle_regular_price = $this-&gt;min_bundle_regular_price + $this-&gt;bundled_item_quantities[ $bundled_item_id ] * $product_regular_price;\n\n\t\t\t\t$this-&gt;max_bundle_price \t\t= $this-&gt;max_bundle_price + $this-&gt;bundled_item_quantities[ $bundled_item_id ] * $bundled_product_price;\n\t\t\t\t$this-&gt;max_bundle_regular_price = $this-&gt;max_bundle_regular_price + $this-&gt;bundled_item_quantities[ $bundled_item_id ] * $product_regular_price;\n\n\t\t\t\tif ( $woocommerce_bundle_helpers-&gt;is_wc_21() ) {\n\n\t\t\t\t\tif ( get_option( &#039;woocommerce_tax_display_shop&#039; ) == &#039;excl&#039; ) {\n\t\t\t\t\t\t$this-&gt;min_bundle_price_excl_tax = $this-&gt;min_bundle_price_excl_tax + $this-&gt;bundled_item_quantities[ $bundled_item_id ] * $bundled_product_price;\n\t\t\t\t\t\t$this-&gt;min_bundle_price_incl_tax = $this-&gt;min_bundle_price_incl_tax + $bundled_product-&gt;get_price_including_tax( $this-&gt;bundled_item_quantities[ $bundled_item_id ], $product_price );\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$this-&gt;min_bundle_price_incl_tax = $this-&gt;min_bundle_price_incl_tax + $this-&gt;bundled_item_quantities[ $bundled_item_id ] * $bundled_product_price;\n\t\t\t\t\t\t$this-&gt;min_bundle_price_excl_tax = $this-&gt;min_bundle_price_excl_tax + $bundled_product-&gt;get_price_excluding_tax( $this-&gt;bundled_item_quantities[ $bundled_item_id ], $product_price );\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\telseif ( $bundled_product-&gt;product_type == &#039;variable&#039; ) {\n\n\t\t\t\t\/\/ prepare price variable for jquery\n\n\t\t\t\t$this-&gt;bundle_price_data[ &#039;prices&#039; ][ $bundled_item_id ] \t\t\t= 0;\n\t\t\t\t$this-&gt;bundle_price_data[ &#039;regular_prices&#039; ][ $bundled_item_id ] \t= 0;\n\n\t\t\t\t\/\/ get all available attributes and settings\n\n\t\t\t\t$this-&gt;bundle_attributes[ $bundled_item_id ] = $bundled_product-&gt;get_variation_attributes();\n\n\t\t\t\t$default_product_attributes = array();\n\n\t\t\t\tif ( $this-&gt;bundle_data[ $bundled_item_id ][ &#039;override_defaults&#039; ] == &#039;yes&#039; ) {\n\t\t\t\t\t$default_product_attributes = $this-&gt;bundle_data[ $bundled_item_id ][ &#039;bundle_defaults&#039; ];\n\t\t\t\t} else {\n\t\t\t\t\t$default_product_attributes = ( array ) maybe_unserialize( get_post_meta( $product_id, &#039;_default_attributes&#039;, true ) );\n\t\t\t\t}\n\n\t\t\t\t$this-&gt;selected_bundle_attributes[ $bundled_item_id ] = apply_filters( &#039;woocommerce_product_default_attributes&#039;, $default_product_attributes );\n\n\t\t\t\t\/\/ calculate min-max variation prices\n\n\t\t\t\t$min_variation_regular_price \t= &#039;&#039;;\n\t\t\t\t$min_variation_price \t\t\t= &#039;&#039;;\n\t\t\t\t$max_variation_regular_price \t= &#039;&#039;;\n\t\t\t\t$max_variation_price \t\t\t= &#039;&#039;;\n\n\t\t\t\t$min_variation_price_incl_tax \t= &#039;&#039;;\n\t\t\t\t$min_variation_price_excl_tax \t= &#039;&#039;;\n\n\t\t\t\t\/\/ filter variations array to add prices and modify price_html \/ stock data\n\n\t\t\t\t$this-&gt;add_bundled_product_get_price_filter( $bundled_item_id );\n\t\t\t\tadd_filter( &#039;woocommerce_available_variation&#039;, array( $this, &#039;woo_bundles_available_variation&#039; ), 10, 3 );\n\n\t\t\t\tif ( $this-&gt;enable_bundle_transients ) {\n\t\t\t\t\t$transient_name = &#039;wc_bundled_item_&#039; . $bundled_item_id . &#039;_&#039; . $this-&gt;id;\n\n\t\t\t\t\tif ( false === ( $bundled_item_variations = get_transient( $transient_name ) ) ) {\n\t\t\t\t\t\t$bundled_item_variations = $bundled_product-&gt;get_available_variations();\n\t\t\t\t\t\tset_transient( $transient_name, $bundled_item_variations );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$bundled_item_variations = $bundled_product-&gt;get_available_variations();\n\t\t\t\t}\n\n\t\t\t\tremove_filter( &#039;woocommerce_available_variation&#039;, array( $this, &#039;woo_bundles_available_variation&#039; ), 10, 3 );\n\t\t\t\t$this-&gt;remove_bundled_product_get_price_filter( $bundled_item_id );\n\n\t\t\t\t\/\/ check stock status of variations - if all of them are out of stock, the product cannot be purchased\n\n\t\t\t\t$variation_in_stock_exists \t\t= false;\n\t\t\t\t$all_variations_on_backorder \t= true;\n\n\t\t\t\t\/\/ add only active variations\n\n\t\t\t\tforeach ( $bundled_item_variations as $variation_data ) {\n\n\t\t\t\t\tif ( ! empty( $variation_data ) )\n\t\t\t\t\t\t$this-&gt;available_bundle_variations[ $bundled_item_id ][] = $variation_data;\n\t\t\t\t\telse\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t\/\/ check stock status of variation - if one of them is in stock, the product can be purchased\n\n\t\t\t\t\tif ( $variation_data[ &#039;is_in_stock&#039; ] )\n\t\t\t\t\t\t$variation_in_stock_exists = true;\n\n\t\t\t\t\tif ( ! $variation_data[ &#039;is_on_backorder&#039; ] )\n\t\t\t\t\t\t$all_variations_on_backorder = false;\n\n\t\t\t\t\t\/\/ lowest price\n\t\t\t\t\tif ( ! is_numeric( $min_variation_regular_price ) || $variation_data[ &#039;regular_price&#039; ] &lt; $min_variation_regular_price )\n\t\t\t\t\t\t$min_variation_regular_price = $variation_data[ &#039;regular_price&#039; ];\n\t\t\t\t\tif ( ! is_numeric( $min_variation_price ) || $variation_data[ &#039;price&#039; ] &lt; $min_variation_price )\n\t\t\t\t\t\t$min_variation_price = $variation_data[ &#039;price&#039; ];\n\n\t\t\t\t\t\/\/ highest price\n\t\t\t\t\tif ( ! is_numeric( $max_variation_regular_price ) || $variation_data[ &#039;regular_price&#039; ] &gt; $max_variation_regular_price )\n\t\t\t\t\t\t$max_variation_regular_price = $variation_data[ &#039;regular_price&#039; ];\n\t\t\t\t\tif ( ! is_numeric( $max_variation_price ) || $variation_data[ &#039;price&#039; ] &gt; $max_variation_price )\n\t\t\t\t\t\t$max_variation_price = $variation_data[ &#039;price&#039; ];\n\n\t\t\t\t\t\/\/ taxed\n\t\t\t\t\tif ( $woocommerce_bundle_helpers-&gt;is_wc_21() ) {\n\n\t\t\t\t\t\tif ( ! is_numeric( $min_variation_price_incl_tax ) || $variation_data[ &#039;price_incl_tax&#039; ] &lt; $min_variation_price_incl_tax )\n\t\t\t\t\t\t\t$min_variation_price_incl_tax = $variation_data[ &#039;price_incl_tax&#039; ];\n\n\t\t\t\t\t\tif ( ! is_numeric( $min_variation_price_excl_tax ) || $variation_data[ &#039;price_excl_tax&#039; ] &lt; $min_variation_price_excl_tax )\n\t\t\t\t\t\t\t$min_variation_price_excl_tax = $variation_data[ &#039;price_excl_tax&#039; ];\n\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( $variation_in_stock_exists == false ) {\n\t\t\t\t\t$this-&gt;all_items_in_stock = false;\n\t\t\t\t}\n\n\t\t\t\tif ( $all_variations_on_backorder ) {\n\t\t\t\t\t$this-&gt;has_items_on_backorder = true;\n\t\t\t\t}\n\n\t\t\t\t$add = ( $min_variation_regular_price &lt; $min_variation_price ) ? $min_variation_regular_price : $min_variation_price;\n\n\t\t\t\t$this-&gt;min_bundle_price \t\t= $this-&gt;min_bundle_price + $this-&gt;bundled_item_quantities[ $bundled_item_id ] * $add;\n\t\t\t\t$this-&gt;min_bundle_regular_price = $this-&gt;min_bundle_regular_price + $this-&gt;bundled_item_quantities[ $bundled_item_id ] * $min_variation_regular_price;\n\n\t\t\t\t$add = ( $max_variation_regular_price &lt; $max_variation_price ) ? $max_variation_regular_price : $max_variation_price;\n\n\t\t\t\t$this-&gt;max_bundle_price \t\t= $this-&gt;max_bundle_price + $this-&gt;bundled_item_quantities[ $bundled_item_id ] * $add;\n\t\t\t\t$this-&gt;max_bundle_regular_price = $this-&gt;max_bundle_regular_price + $this-&gt;bundled_item_quantities[ $bundled_item_id ] * $max_variation_regular_price;\n\n\t\t\t\tif ( $woocommerce_bundle_helpers-&gt;is_wc_21() ) {\n\t\t\t\t\t$this-&gt;min_bundle_price_excl_tax = $this-&gt;min_bundle_price_excl_tax + $this-&gt;bundled_item_quantities[ $bundled_item_id ] * $min_variation_price_excl_tax;\n\t\t\t\t\t$this-&gt;min_bundle_price_incl_tax = $this-&gt;min_bundle_price_incl_tax + $this-&gt;bundled_item_quantities[ $bundled_item_id ] * $min_variation_price_incl_tax;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction woo_bundles_available_variation( $variation_data, $bundled_product, $bundled_variation ) {\n\n\t\tglobal $woocommerce_bundles, $woocommerce_bundle_helpers;\n\n\t\t$bundled_item_id = $this-&gt;processing_item_id;\n\n\t\t\/\/ Update sold individually status\n\n\t\tif ( ! $bundled_variation-&gt;is_sold_individually() )\n\t\t\t$this-&gt;all_items_sold_individually = false;\n\n\t\t\/\/ Disable if certain conditions are met\n\n\t\tif ( $this-&gt;bundle_data[ $bundled_item_id ][ &#039;filter_variations&#039; ] == &#039;yes&#039; ) {\n\t\t\tif ( ! is_array( $this-&gt;bundle_data[ $bundled_item_id ][ &#039;allowed_variations&#039; ] ) )\n\t\t\t\treturn array();\n\t\t\tif ( ! in_array( $bundled_variation-&gt;variation_id, $this-&gt;bundle_data[ $bundled_item_id ][ &#039;allowed_variations&#039; ] ) )\n\t\t\t\treturn array();\n\t\t}\n\n\t\tif ( $bundled_variation-&gt;price === &#039;&#039; ) {\n\t\t\treturn array();\n\t\t}\n\n\t\t\/\/ Modify product id for JS\n\n\t\t$variation_data[ &#039;product_id&#039; ] = $bundled_item_id;\n\n\t\t\/\/ Add price info\n\n\t\t$variation_data[ &#039;regular_price&#039; ] \t= $woocommerce_bundle_helpers-&gt;get_bundled_product_price( $bundled_variation, $woocommerce_bundle_helpers-&gt;get_bundled_regular_product_price( $bundled_variation ) );\n\t\t$variation_data[ &#039;price&#039; ]\t\t\t= $woocommerce_bundle_helpers-&gt;get_bundled_product_price( $bundled_variation, $bundled_variation-&gt;get_price() );\n\n\t\tif ( $woocommerce_bundle_helpers-&gt;is_wc_21() ) {\n\n\t\t\tif ( get_option( &#039;woocommerce_tax_display_shop&#039; ) == &#039;excl&#039; ) {\n\n\t\t\t\t$variation_data[ &#039;regular_price_excl_tax&#039; ] = $variation_data[ &#039;regular_price&#039; ];\n\t\t\t\t$variation_data[ &#039;regular_price_incl_tax&#039; ] = $bundled_variation-&gt;get_price_including_tax( 1, $woocommerce_bundle_helpers-&gt;get_bundled_regular_product_price( $bundled_variation ) );\n\n\t\t\t\t$variation_data[ &#039;price_excl_tax&#039; ] = $variation_data[ &#039;price&#039; ];\n\t\t\t\t$variation_data[ &#039;price_incl_tax&#039; ] = $bundled_variation-&gt;get_price_including_tax( 1, $bundled_variation-&gt;get_price() );\n\n\t\t\t} else {\n\n\t\t\t\t$variation_data[ &#039;regular_price_incl_tax&#039; ] = $variation_data[ &#039;regular_price&#039; ];\n\t\t\t\t$variation_data[ &#039;regular_price_excl_tax&#039; ] = $bundled_variation-&gt;get_price_excluding_tax( 1, $woocommerce_bundle_helpers-&gt;get_bundled_regular_product_price( $bundled_variation ) );\n\n\t\t\t\t$variation_data[ &#039;price_incl_tax&#039; ] = $variation_data[ &#039;price&#039; ];\n\t\t\t\t$variation_data[ &#039;price_excl_tax&#039; ] = $bundled_variation-&gt;get_price_excluding_tax( 1, $bundled_variation-&gt;get_price() );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( $variation_data[ &#039;regular_price&#039; ] &gt; $variation_data[ &#039;price&#039; ] )\n\t\t\t$this-&gt;on_sale = true;\n\n\t\t$variation_data[ &#039;price_html&#039; ]\t= $this-&gt;per_product_pricing_active ? &#039;&lt;span class=&quot;price&quot;&gt;&#039; . $bundled_variation-&gt;get_price_html() . &#039;&lt;\/span&gt;&#039; : &#039;&#039;;\n\n\t\t$availability = $woocommerce_bundle_helpers-&gt;get_bundled_product_availability( $bundled_variation, $this-&gt;bundled_item_quantities[ $bundled_item_id ] );\n\n\t\tif ( $availability[ &#039;class&#039; ] == &#039;out-of-stock&#039; )\n\t\t\t$variation_data[ &#039;is_in_stock&#039; ] = false;\n\n\t\t$variation_data[ &#039;is_on_backorder&#039; ] = $availability[ &#039;class&#039; ] == &#039;available-on-backorder&#039; ? true : false;\n\n\t\t$availability_html \t= ( ! empty( $availability[&#039;availability&#039;] ) ) ? apply_filters( &#039;woocommerce_stock_html&#039;, &#039;&lt;p class=&quot;stock &#039; . $availability[&#039;class&#039;] . &#039;&quot;&gt;&#039;. $availability[&#039;availability&#039;].&#039;&lt;\/p&gt;&#039;, $availability[&#039;availability&#039;]  ) : &#039;&#039;;\n\n\t\t$variation_data[ &#039;availability_html&#039; ] = $availability_html;\n\n\t\treturn $variation_data;\n\t}\n\n\tfunction add_bundled_product_get_price_filter( $bundled_item_id ) {\n\n\t\t$this-&gt;item_id_for_price_filter = $bundled_item_id;\n\n\t\tadd_filter( &#039;woocommerce_get_price&#039;, array( $this, &#039;bundled_product_get_price_filter&#039; ), 100, 2 );\n\t\tadd_filter( &#039;woocommerce_get_regular_price&#039;, array( $this, &#039;bundled_product_get_regular_price_filter&#039; ), 100, 2 );\n\t\tadd_filter( &#039;woocommerce_get_price_html&#039;, array( $this, &#039;bundled_product_get_price_html_filter&#039; ), 10, 2 );\n\t}\n\n\tfunction bundled_product_get_price_html_filter( $price_html, $product ) {\n\n\t\tif ( ! empty ( $this-&gt;item_id_for_price_filter ) &amp;&amp; ! isset( $product-&gt;is_filtered_price_html ) ) {\n\n\t\t\tif ( ! $this-&gt;per_product_pricing_active )\n\t\t\t\treturn &#039;&#039;;\n\n\t\t\t$product-&gt;sale_price \t= $product-&gt;get_price();\n\t\t\t$product-&gt;price \t\t= $product-&gt;get_price();\n\n\t\t\t$product-&gt;is_filtered_price_html = &#039;yes&#039;;\n\n\t\t\treturn $product-&gt;get_price_html();\n\t\t}\n\n\t\treturn $price_html;\n\t}\n\n\tfunction bundled_product_get_price_filter( $price, $product ) {\n\n\t\tif ( ! empty ( $this-&gt;item_id_for_price_filter ) ) {\n\n\t\t\tif ( ! $this-&gt;per_product_pricing_active )\n\t\t\t\treturn 0;\n\n\t\t\t$bundled_item_id = $this-&gt;item_id_for_price_filter;\n\n\t\t\t$regular_price \t= $product-&gt;regular_price;\n\t\t\t$price \t\t\t= $product-&gt;price;\n\n\t\t\t$discount = $this-&gt;bundled_item_discounts[ $bundled_item_id ];\n\n\t\t\treturn empty( $discount ) || empty( $regular_price ) ? $price : ( double ) $regular_price * ( 100 - $discount ) \/ 100;\n\t\t}\n\n\t\treturn $price;\n\t}\n\n\tfunction bundled_product_get_regular_price_filter( $price, $product ) {\n\n\t\tif ( ! empty ( $this-&gt;item_id_for_price_filter ) ) {\n\n\t\t\tif ( ! $this-&gt;per_product_pricing_active )\n\t\t\t\treturn 0;\n\n\t\t\t$regular_price \t= $product-&gt;regular_price;\n\t\t\t$price \t\t\t= $product-&gt;price;\n\n\t\t\treturn empty( $regular_price ) ? ( double ) $price : ( double ) $regular_price;\n\t\t}\n\n\t\treturn $price;\n\t}\n\n\tfunction remove_bundled_product_get_price_filter( $bundled_item_id ) {\n\n\t\t$this-&gt;item_id_for_price_filter = &#039;&#039;;\n\n\t\tremove_filter( &#039;woocommerce_get_price&#039;, array( $this, &#039;bundled_product_get_price_filter&#039; ), 100, 2 );\n\t\tremove_filter( &#039;woocommerce_get_regular_price&#039;, array( $this, &#039;bundled_product_get_regular_price_filter&#039; ), 100, 2 );\n\t\tremove_filter( &#039;woocommerce_get_price_html&#039;, array( $this, &#039;bundled_product_get_price_html_filter&#039; ), 10, 2 );\n\t}\n\n\tfunction get_bundle_price_data() {\n\t\treturn $this-&gt;bundle_price_data;\n\t}\n\n\tfunction get_bundle_attributes() {\n\t\treturn $this-&gt;bundle_attributes;\n\t}\n\n\tfunction get_bundled_item_quantities() {\n\t\treturn $this-&gt;bundled_item_quantities;\n\t}\n\n\tfunction get_selected_bundle_attributes() {\n\t\treturn $this-&gt;selected_bundle_attributes;\n\t}\n\n\tfunction get_available_bundle_variations() {\n\t\treturn $this-&gt;available_bundle_variations;\n\t}\n\n\tfunction get_bundled_products() {\n\t\treturn $this-&gt;bundled_products;\n\t}\n\n\tfunction get_price() {\n\n\t\tif ( $this-&gt;per_product_pricing_active )\n\t\t\treturn $this-&gt;microdata_display ? $this-&gt;min_bundle_price : ( double ) 0;\n\t\telse\n\t\t\treturn parent::get_price();\n\t}\n\n\tfunction get_regular_price() {\n\n\t\tif ( $this-&gt;per_product_pricing_active )\n\t\t\treturn ( double ) 0;\n\t\telse\n\t\t\treturn $this-&gt;regular_price;\n\t}\n\n\tfunction get_price_suffix() {\n\n\t \tglobal $woocommerce_bundle_helpers;\n\n\t \tif ( ! $woocommerce_bundle_helpers-&gt;is_wc_21() )\n\t \t\treturn &#039;&#039;;\n\n\t\tif ( $this-&gt;per_product_pricing_active ) {\n\n\t\t\t$price_display_suffix  = get_option( &#039;woocommerce_price_display_suffix&#039; );\n\n\t\t\tif ( $price_display_suffix ) {\n\t\t\t\t$price_display_suffix = &#039; &lt;small class=&quot;woocommerce-price-suffix&quot;&gt;&#039; . $price_display_suffix . &#039;&lt;\/small&gt;&#039;;\n\n\t\t\t\t$find = array(\n\t\t\t\t\t&#039;{price_including_tax}&#039;,\n\t\t\t\t\t&#039;{price_excluding_tax}&#039;\n\t\t\t\t);\n\n\t\t\t\t$replace = array(\n\t\t\t\t\twc_bundles_price( $this-&gt;min_bundle_price_incl_tax ),\n\t\t\t\t\twc_bundles_price( $this-&gt;min_bundle_price_excl_tax ),\n\t\t\t\t);\n\n\t\t\t\t$price_display_suffix = str_replace( $find, $replace, $price_display_suffix );\n\t\t\t}\n\n\t\t\treturn apply_filters( &#039;woocommerce_get_price_suffix&#039;, $price_display_suffix, $this );\n\n\t\t} else {\n\n\t\t\treturn parent::get_price_suffix();\n\t\t}\n\n\t}\n\n\tfunction get_price_html( $price = &#039;&#039; ) {\n\n\t\tglobal $woocommerce_bundle_helpers;\n\n\t\tif ( ! $woocommerce_bundle_helpers-&gt;is_wc_21() )\n\t\t\treturn $this-&gt;get_price_html_20();\n\n\t\tif ( $this-&gt;per_product_pricing_active ) {\n\n\t\t\t\/\/ Get the price\n\t\t\tif ( $this-&gt;min_bundle_price === &#039;&#039; ) {\n\n\t\t\t\t$price = apply_filters( &#039;woocommerce_bundle_empty_price_html&#039;, &#039;&#039;, $this );\n\n\t\t\t} else {\n\n\t\t\t\t\/\/ Main price\n\t\t\t\t$prices = array( $this-&gt;min_bundle_price, $this-&gt;max_bundle_price );\n\n\t\t\t\tif ( ! $this-&gt;contains_nyp )\n\t\t\t\t\t$price = $prices[0] !== $prices[1] ? sprintf( _x( &#039;%1$s&amp;ndash;%2$s&#039;, &#039;Price range: from-to&#039;, &#039;woocommerce&#039; ), wc_price( $prices[0] ), wc_price( $prices[1] ) ) : wc_price( $prices[0] );\n\t\t\t\telse\n\t\t\t\t\t$price = wc_price( $prices[0] );\n\n\t\t\t\t\/\/ Sale\n\t\t\t\t$prices = array( $this-&gt;min_bundle_regular_price, $this-&gt;max_bundle_regular_price );\n\t\t\t\tsort( $prices );\n\n\t\t\t\tif ( ! $this-&gt;contains_nyp )\n\t\t\t\t\t$saleprice = $prices[0] !== $prices[1] ? sprintf( _x( &#039;%1$s&amp;ndash;%2$s&#039;, &#039;Price range: from-to&#039;, &#039;woocommerce&#039; ), wc_price( $prices[0] ), wc_price( $prices[1] ) ) : wc_price( $prices[0] );\n\t\t\t\telse\n\t\t\t\t\t$saleprice = wc_price( $prices[0] );\n\n\t\t\t\tif ( $price !== $saleprice ) {\n\t\t\t\t\t$price = apply_filters( &#039;woocommerce_bundle_sale_price_html&#039;, $this-&gt;contains_nyp ? sprintf( _x( &#039;%1$s%2$s&#039;, &#039;Price range: from&#039;, &#039;woocommerce-bto&#039; ), $this-&gt;get_price_html_from_text(), $this-&gt;get_price_html_from_to( $saleprice, $price ) . $this-&gt;get_price_suffix() ) : $this-&gt;get_price_html_from_to( $saleprice, $price ) . $this-&gt;get_price_suffix(), $this );\n\t\t\t\t} else {\n\t\t\t\t\t$price = apply_filters( &#039;woocommerce_bundle_price_html&#039;, $this-&gt;contains_nyp ? sprintf( _x( &#039;%1$s%2$s&#039;, &#039;Price range: from&#039;, &#039;woocommerce-bto&#039; ), $this-&gt;get_price_html_from_text(), $price . $this-&gt;get_price_suffix() ) : $price . $this-&gt;get_price_suffix(), $this );\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn apply_filters( &#039;woocommerce_get_price_html&#039;, $price, $this );\n\n\t\t} else {\n\n\t\t\treturn parent::get_price_html();\n\t\t}\n\n\t}\n\n\tfunction get_price_html_20( $price = &#039;&#039; ) {\n\n\t\tif ( $this-&gt;per_product_pricing_active ) {\n\n\t\t\t\/\/ Get the price\n\t\t\tif ( $this-&gt;min_bundle_price &gt; 0 ) :\n\t\t\t\tif ( $this-&gt;is_on_sale() &amp;&amp; $this-&gt;min_bundle_regular_price !== $this-&gt;min_bundle_price ) :\n\n\t\t\t\t\tif ( !$this-&gt;min_bundle_price || $this-&gt;min_bundle_price !== $this-&gt;max_bundle_price || $this-&gt;contains_nyp )\n\t\t\t\t\t\t$price .= $this-&gt;get_price_html_from_text();\n\n\t\t\t\t\t$price .= $this-&gt;get_price_html_from_to( $this-&gt;min_bundle_regular_price, $this-&gt;min_bundle_price ) . $this-&gt;get_price_suffix();\n\n\t\t\t\t\t$price = apply_filters(&#039;woocommerce_bundle_sale_price_html&#039;, $price, $this);\n\n\t\t\t\telse :\n\n\t\t\t\t\tif ( ! $this-&gt;min_bundle_price || $this-&gt;min_bundle_price !== $this-&gt;max_bundle_price || $this-&gt;contains_nyp )\n\t\t\t\t\t\t$price .= $this-&gt;get_price_html_from_text();\n\n\t\t\t\t\t$price .= wc_bundles_price( $this-&gt;min_bundle_price ) . $this-&gt;get_price_suffix();\n\n\t\t\t\t\t$price = apply_filters(&#039;woocommerce_bundle_price_html&#039;, $price, $this);\n\n\t\t\t\tendif;\n\t\t\telseif ( $this-&gt;min_bundle_price === &#039;&#039; ) :\n\n\t\t\t\t$price = apply_filters(&#039;woocommerce_bundle_empty_price_html&#039;, &#039;&#039;, $this);\n\n\t\t\telseif ( $this-&gt;min_bundle_price == 0 ) :\n\n\t\t\t\tif ($this-&gt;is_on_sale() &amp;&amp; isset($this-&gt;min_bundle_regular_price) &amp;&amp; $this-&gt;min_bundle_regular_price !== $this-&gt;min_bundle_price ) :\n\n\t\t\t\t\tif ( ! $this-&gt;min_bundle_price || $this-&gt;min_bundle_price !== $this-&gt;max_bundle_price || $this-&gt;contains_nyp )\n\t\t\t\t\t\t$price .= $this-&gt;get_price_html_from_text();\n\n\t\t\t\t\t$price .= $this-&gt;get_price_html_from_to( $this-&gt;min_bundle_regular_price, __(&#039;Free!&#039;, &#039;woocommerce&#039;) );\n\n\t\t\t\t\t$price = apply_filters(&#039;woocommerce_bundle_free_sale_price_html&#039;, $price, $this);\n\n\t\t\t\telse :\n\n\t\t\t\t\tif ( !$this-&gt;min_bundle_price || $this-&gt;min_bundle_price !== $this-&gt;max_bundle_price || $this-&gt;contains_nyp )\n\t\t\t\t\t\t$price .= $this-&gt;get_price_html_from_text();\n\n\t\t\t\t\t$price .= __(&#039;Free!&#039;, &#039;woocommerce&#039;);\n\n\t\t\t\t\t$price = apply_filters(&#039;woocommerce_bundle_free_price_html&#039;, $price, $this);\n\n\t\t\t\tendif;\n\n\t\t\tendif;\n\n\t\t\treturn apply_filters( &#039;woocommerce_get_price_html&#039;, $price, $this );\n\n\t\t} else {\n\n\t\t\treturn parent::get_price_html();\n\t\t}\n\n\t}\n\n\tfunction is_on_sale() {\n\n\t\t$is_on_sale = false;\n\n\t\tif ( $this-&gt;per_product_pricing_active &amp;&amp; ! empty( $this-&gt;bundle_data ) ) {\n\n\t\t\tif ( $this-&gt;on_sale )\n\t\t\t\t$is_on_sale = true;\n\n\t\t} else {\n\n\t\t\tif ( $this-&gt;sale_price &amp;&amp; $this-&gt;sale_price == $this-&gt;price )\n\t\t\t\t$is_on_sale = true;\n\t\t}\n\n\t\treturn apply_filters( &#039;woocommerce_bundle_is_on_sale&#039;, $is_on_sale, $this );\n\t}\n\n\t\/**\n\t * Returns whether or not the bundle has any attributes set\n\t *\/\n\tfunction has_attributes() {\n\t\t\/\/ check bundle for attributes\n\t\tif ( sizeof( $this-&gt;get_attributes() ) &gt; 0 ) :\n\t\t\tforeach ( $this-&gt;get_attributes() as $attribute ) :\n\t\t\t\tif ( isset( $attribute[&#039;is_visible&#039;] ) &amp;&amp; $attribute[&#039;is_visible&#039;] ) return true;\n\t\t\tendforeach;\n\t\tendif;\n\t\t\/\/ check all bundled items for attributes\n\t\tif ( $this-&gt;get_bundled_products() ) {\n\t\t\tforeach ( $this-&gt;get_bundled_products() as $bundled_product ) {\n\t\t\t\tif ( sizeof( $bundled_product-&gt;get_attributes() ) &gt; 0 ) :\n\t\t\t\t\tforeach ( $bundled_product-&gt;get_attributes() as $attribute ) :\n\t\t\t\t\t\tif ( isset( $attribute[&#039;is_visible&#039;] ) &amp;&amp; $attribute[&#039;is_visible&#039;] )\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\tendforeach;\n\t\t\t\tendif;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tfunction is_sold_individually() {\n\t\treturn parent::is_sold_individually() || $this-&gt;all_items_sold_individually;\n\t}\n\n\tfunction get_availability() {\n\n\t\t$backend_availability_data = parent::get_availability();\n\n\t\tif ( ! is_admin() ) {\n\n\t\t\t$availability = $class = &#039;&#039;;\n\n\t\t\tif ( ! $this-&gt;all_items_in_stock ) {\n\n\t\t\t\t$availability = __( &#039;Out of stock&#039;, &#039;woocommerce&#039; );\n\t\t\t\t$class        = &#039;out-of-stock&#039;;\n\n\t\t\t} elseif ( $this-&gt;has_items_on_backorder ) {\n\n\t\t\t\t$availability = __( &#039;Available on backorder&#039;, &#039;woocommerce&#039; );\n\t\t\t\t$class        = &#039;available-on-backorder&#039;;\n\n\t\t\t}\n\n\t\t\tif ( $backend_availability_data[ &#039;class&#039; ] == &#039;out-of-stock&#039; || $backend_availability_data[ &#039;class&#039; ] == &#039;available-on-backorder&#039; )\n\t\t\t\treturn $backend_availability_data;\n\t\t\telseif ( $class == &#039;out-of-stock&#039; || $class == &#039;available-on-backorder&#039; )\n\t\t\t\treturn array( &#039;availability&#039; =&gt; $availability, &#039;class&#039; =&gt; $class );\n\n\t\t}\n\n\t\treturn $backend_availability_data;\n\t}\n\n\t\/**\n\t * Lists a table of attributes for the bundle page\n\t *\/\n\tfunction list_attributes() {\n\n\t\t\/\/ show attributes attached to the bundle only\n\t\twc_bundles_get_template( &#039;single-product\/product-attributes.php&#039;, array(\n\t\t\t&#039;product&#039; =&gt; $this\n\t\t), &#039;&#039;, &#039;&#039; );\n\n\t\tforeach ( $this-&gt;get_bundled_products() as $bundled_item_id =&gt; $bundled_product ) {\n\n\t\t\tif ( ! $this-&gt;per_product_shipping_active )\n\t\t\t\t$bundled_product-&gt;length = $bundled_product-&gt;width = $bundled_product-&gt;weight = &#039;&#039;;\n\n\t\t\tif ( $bundled_product-&gt;has_attributes() ) {\n\n\t\t\t\t$GLOBALS[&#039;listing_attributes_of&#039;] = $bundled_item_id;\n\n\t\t\t\techo &#039;&lt;h3&gt;&#039;.get_the_title( $bundled_product-&gt;id ).&#039;&lt;\/h3&gt;&#039;;\n\n\t\t\t\twc_bundles_get_template( &#039;single-product\/product-attributes.php&#039;, array(\n\t\t\t\t\t&#039;product&#039; =&gt; $bundled_product\n\t\t\t\t), &#039;&#039;, &#039;&#039; );\n\t\t\t}\n\t\t}\n\t\tunset( $GLOBALS[&#039;listing_attributes_of&#039;] );\n\t}\n\n\t\/**\n\t * Get the add to url used mainly in loops.\n\t *\/\n\tfunction add_to_cart_url() {\n\n\t\t$url = $this-&gt;is_purchasable() &amp;&amp; $this-&gt;is_in_stock() &amp;&amp; $this-&gt;all_items_in_stock &amp;&amp; empty( $this-&gt;available_bundle_variations ) ? remove_query_arg( &#039;added-to-cart&#039;, add_query_arg( &#039;add-to-cart&#039;, $this-&gt;id ) ) : get_permalink( $this-&gt;id );\n\n\t\treturn apply_filters( &#039;bundle_add_to_cart_url&#039;, $url, $this );\n\t}\n\n\t\/**\n\t * Get the add to cart button text\n\t *\/\n\tfunction add_to_cart_text() {\n\n\t\t$text = __( &#039;Read More&#039;, &#039;woocommerce&#039; );\n\n\t\tif ( $this-&gt;is_purchasable() &amp;&amp; $this-&gt;is_in_stock() &amp;&amp; $this-&gt;all_items_in_stock ) {\n\t\t\tif ( empty( $this-&gt;available_bundle_variations ) )\n\t\t\t\t$text =  __( &#039;Add to cart&#039;, &#039;woocommerce&#039; );\n\t\t\telse\n\t\t\t\t$text =  __( &#039;Select options&#039;, &#039;woocommerce&#039; );\n\t\t}\n\n\t\treturn apply_filters( &#039;bundle_add_to_cart_text&#039;, $text, $this );\n\t}\n\n}<\/code><\/pre>\n<p>Thanks in advance \ud83d\ude00<\/p>\n","protected":false},"template":"","class_list":["post-5493296","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/5493296","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/5493296\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=5493296"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}