types = Array( 'percent_total_amount' => __('Percentage of cart total amount', 'aco-woo-dynamic-pricing'), 'percent_product_price' => __('Percentage of product price', 'aco-woo-dynamic-pricing'), 'fixed_product_price' => __('Fixed price of product price', 'aco-woo-dynamic-pricing'), 'fixed_cart_amount' => __('Fixed price of cart total amount', 'aco-woo-dynamic-pricing'), 'cart_quantity' => __('Quantity based discount', 'aco-woo-dynamic-pricing') ); } /** * * Ensures only one instance of AWDP is loaded or can be loaded. * * @since 1.0.0 * @static * @see WordPress_Plugin_Template() * @return Main AWDP instance */ public static function instance($file = '', $version = '1.0.0') { if (is_null(self::$_instance)) { self::$_instance = new self($file, $version); } return self::$_instance; } /** * @return bool */ public function isActive() { return $this->_active; } // Cart Price View public function cart_discount_items ( $item_price, $cart_item ) { $prod_ID = $cart_item['data']->get_data()['slug']; $cart_prod_id = ( $cart_item['variation_id'] == 0 || $cart_item['variation_id'] == '' ) ? $cart_item['product_id'] : $cart_item['variation_id']; $QNitems = $this->wdpQNitems; if ( $this->converted_rate == '' && $cart_item['data']->get_ID() != '' && array_key_exists ( $prod_ID, $this->wdp_discounted_price ) ) { $this->converted_rate = $this->get_con_unit($cart_item['data'], wc_remove_number_precision($this->wdp_discounted_price[$prod_ID])); } // $converted_rate = $this->converted_rate; $converted_rate = 1; if ( $this->discount_rules != false && sizeof($this->discount_rules) >= 1 && $this->check_discount($prod_ID) && false == $this->awdp_cart_rules ) { $discounted_price = abs(wc_remove_number_precision($this->wdp_discounted_price[$prod_ID])); $product_actual_price = isset ( $this->actual_price ) ? ( ( array_key_exists($prod_ID, $this->actual_price) && $this->actual_price[$prod_ID] > 0 ) ? $this->actual_price[$prod_ID] : ( ( $cart_item['data']->get_data()['price'] == 0 && isset($cart_item['data']->price) ) ? $cart_item['data']->price : $cart_item['data']->get_data()['price'] ) ) : ( ( $cart_item['data']->get_data()['price'] == 0 && isset($cart_item['data']->price) ) ? $cart_item['data']->price : $cart_item['data']->get_data()['price'] ); $quantity = 1; $product = wc_get_product( $cart_prod_id ); if ($product_actual_price > 0) { if (WC()->cart->display_prices_including_tax()) { $product_actual_price = $this->wdp_price_including_tax ( $product, array ( 'qty' => $quantity, 'price' => $product_actual_price, ), $product_actual_price ); if( $discounted_price > 0.0000000001 ) { $discounted_price = $this->wdp_price_including_tax ( $product, array ( 'qty' => $quantity, 'price' => $discounted_price, ), $discounted_price ); } } else { $product_actual_price = $this->wdp_price_excluding_tax ( $product, array ( 'qty' => $quantity, 'price' => $product_actual_price ), $product_actual_price ); if( $discounted_price > 0.0000000001 ) { $discounted_price = $this->wdp_price_excluding_tax ( $product, array ( 'qty' => $quantity, 'price' => $discounted_price, ), $discounted_price ); } } } else { $product_actual_price = $product_actual_price; $discounted_price = $discounted_price; } if ( ( sizeof($QNitems) > 0 ) && array_search ( $cart_prod_id, array_column ( $QNitems, 'product_id' ) ) !== false ) { $qn_index = array_search ( $cart_prod_id, array_column ( $QNitems, 'product_id' ) ); $qn_price = wc_remove_number_precision ( $QNitems[$qn_index]['discounted_price'] ); if ($qn_price > 0) { if (WC()->cart->display_prices_including_tax()) { // $product_actual_price = $this->wdp_price_including_tax ( $product, array ( // 'qty' => $quantity, // 'price' => $product_actual_price, // ), $product_actual_price ); $qn_price = $this->wdp_price_including_tax ( $product, array ( 'qty' => $quantity, 'price' => $qn_price, ), $qn_price ); } else { // $product_actual_price = $this->wdp_price_excluding_tax ( $product, array ( // 'qty' => $quantity, // 'price' => $product_actual_price // ), $product_actual_price ); $qn_price = $this->wdp_price_excluding_tax ( $product, array( 'qty' => $quantity, 'price' => $qn_price ), $qn_price ); } } else { $qn_price = $qn_price; } if( ( $discounted_price > 0.0000000001 ) && ( $discounted_price < $product_actual_price ) ) { $item_price = wc_format_sale_price($discounted_price * $converted_rate, $qn_price * $converted_rate ); } else { $item_price = wc_format_sale_price($product_actual_price * $converted_rate, $qn_price * $converted_rate ); } } else if (($discounted_price > 0.0000000001 && ($discounted_price < $product_actual_price)) || $discounted_price == 0) { $item_price = wc_format_sale_price($product_actual_price * $converted_rate, $discounted_price * $converted_rate); } else if ($discounted_price > $product_actual_price) { $item_price = wc_format_sale_price($product_actual_price * $converted_rate, $discounted_price * $converted_rate); } } return $item_price; } // Price View HTML public function get_product_price_html($item_price, $product) { $prod_ID = $product->get_data()['slug']; if ( $this->converted_rate == '' && $product->get_ID() != '' && array_key_exists ( $prod_ID, $this->wdp_discounted_price ) ) { $this->converted_rate = $this->get_con_unit($product, wc_remove_number_precision($this->wdp_discounted_price[$prod_ID])); } // $converted_rate = $this->converted_rate; $converted_rate = 1; // Variable Product if( $product->is_type( 'variable' ) ) { // Price display for variable product $variations = $product->get_available_variations(); if($variations) { if(array_key_exists($prod_ID, $this->variations) && $this->variations[$prod_ID]){ $wdp_max_price = $product->get_variation_price( 'max', true ); $wdp_min_price = $product->get_variation_price( 'min', true ); $wdp_dsc_max_price = max($this->variations[$prod_ID]); $wdp_dsc_min_price = min($this->variations[$prod_ID]); if( $wdp_min_price == $wdp_dsc_min_price && $wdp_max_price == $wdp_dsc_max_price ) { return $item_price; } else { if ( $wdp_dsc_max_price !== $wdp_dsc_min_price ) { $item_price = '
'.wc_format_price_range( $wdp_min_price, $wdp_max_price ).' '.wc_format_price_range( $wdp_dsc_min_price, $wdp_dsc_max_price ).'
| ' . $awdp_qn_label . '*' . ' | '; $tr_pr = '|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ' . $awdp_pc_label . ' | '; if ( $value_display == 'discount_both' ) { $tr_nw = '|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ' . $awdp_nw_label . ' | '; } } else { if ( $value_display == 'discount_both' ) { $table = '
| ' . $awdp_qn_label . '*' . ' | ' . $awdp_pc_label . ' | ' . $awdp_nw_label . ' |
| ' . $awdp_qn_label . '*' . ' | ' . $awdp_pc_label . ' | ' . $quantity_rule['start_range'] . ' | '; } else if ($quantity_rule['end_range']) { $tr_qn .= '' . $quantity_rule['start_range'] . ' - ' . $quantity_rule['end_range'] . ' | '; } else { $tr_qn .= '' . $quantity_rule['start_range'] . ' + | '; } if ( $value_display == 'discount_value' ) { if ($discount_typ == 'percentage') { $tr_pr .= '' .(float)$discount_val . $prcn_text . ' | '; } else if ($discount_typ == 'fixed') { $tr_pr .= '' . wc_price((float)$discount_val) . $fxd_text . ' | '; } } else if ( $value_display == 'discount_both' ) { // Display Both Price and Value if ($discount_typ == 'percentage') { $tr_pr .= '' .(float)$discount_val . $prcn_text . ' | '; } else if ($discount_typ == 'fixed') { $tr_pr .= '' . wc_price((float)$discount_val) . $fxd_text . ' | '; } if ( $discounted_new_min_price == $discounted_new_max_price ) { $tr_nw .= '' . $discounted_new_min_price . ' | '; } else { $tr_nw .= '' . $discounted_new_min_price . ' - ' . $discounted_new_max_price . ' | '; } } else { if ( $discounted_new_min_price == $discounted_new_max_price ) { $tr_pr .= '' . $discounted_new_min_price . ' | '; } else { $tr_pr .= '' . $discounted_new_min_price . ' - ' . $discounted_new_max_price . ' | '; } } } else { if ( $quantity_rule['start_range'] == $quantity_rule['end_range'] ) { $table .= '
| ' . $quantity_rule['start_range'] . ' | '; if ( $value_display == 'discount_value' ) { if ($discount_typ == 'percentage') { $table .= '' .(float)$discount_val . $prcn_text . ' | '; } else if ($discount_typ == 'fixed') { $table .= '' . wc_price((float)$discount_val) . $fxd_text . ' | '; } } else if ( $value_display == 'discount_both' ) { if ( $discount_typ == 'percentage' ) { $table .= '' .(float)$discount_val . $prcn_text . ' | '; } else if ($discount_typ == 'fixed') { $table .= '' . wc_price((float)$discount_val) . $fxd_text . ' | '; } if ( $discounted_new_min_price == $discounted_new_max_price ) { $table .= '' . $discounted_new_min_price . ' | '; } else { $table .= '' . $discounted_new_min_price . ' - ' . $discounted_new_max_price . ' | '; } } else { if ( $discounted_new_min_price == $discounted_new_max_price ) { $table .= '' . $discounted_new_min_price . ' | '; } else { $table .= '' . $discounted_new_min_price . ' - ' . $discounted_new_max_price . ' | '; } } $table .= '
| ' . $quantity_rule['start_range'] . ' - ' . $quantity_rule['end_range'] . ' | '; if ( $value_display == 'discount_value' ) { if ($discount_typ == 'percentage') { $table .= '' .(float)$discount_val . $prcn_text . ' | '; } else if ($discount_typ == 'fixed') { $table .= '' . wc_price((float)$discount_val) . $fxd_text . ' | '; } } else if ( $value_display == 'discount_both' ) { if ( $discount_typ == 'percentage' ) { $table .= '' .(float)$discount_val . $prcn_text . ' | '; } else if ($discount_typ == 'fixed') { $table .= '' . wc_price((float)$discount_val) . $fxd_text . ' | '; } if ( $discounted_new_min_price == $discounted_new_max_price ) { $table .= '' . $discounted_new_min_price . ' | '; } else { $table .= '' . $discounted_new_min_price . ' - ' . $discounted_new_max_price . ' | '; } } else { if ( $discounted_new_min_price == $discounted_new_max_price ) { $table .= '' . $discounted_new_min_price . ' | '; } else { $table .= '' . $discounted_new_min_price . ' - ' . $discounted_new_max_price . ' | '; } } $table .= '
| ' . $quantity_rule['start_range'] . ' + | '; if ( $value_display == 'discount_value' ) { if ($discount_typ == 'percentage') { $table .= '' .(float)$discount_val . $prcn_text . ' | '; } else if ($discount_typ == 'fixed') { $table .= '' . wc_price((float)$discount_val) . $fxd_text . ' | '; } } else if ( $value_display == 'discount_both' ) { if ($discount_typ == 'percentage') { $table .= '' .(float)$discount_val . $prcn_text . ' | '; } else if ($discount_typ == 'fixed') { $table .= '' . wc_price((float)$discount_val) . $fxd_text . ' | '; } if ($discounted_new_min_price == $discounted_new_max_price) { $table .= '' . $discounted_new_min_price . ' | '; } else { $table .= '' . $discounted_new_min_price . ' - ' . $discounted_new_max_price . ' | '; } } else { if ($discounted_new_min_price == $discounted_new_max_price) { $table .= '' . $discounted_new_min_price . ' | '; } else { $table .= '' . $discounted_new_min_price . ' - ' . $discounted_new_max_price . ' | '; } } $table .= '' . $quantity_rule['start_range'] . ' | '; } else if ($quantity_rule['end_range']) { $tr_qn .= '' . $quantity_rule['start_range'] . ' - ' . $quantity_rule['end_range'] . ' | '; } else { $tr_qn .= '' . $quantity_rule['start_range'] . ' + | '; } $tr_pr .= '' . $discounted_new_price . ' | '; if ( $value_display == 'discount_both' ) { $tr_nw .= '' . $discounted_new_price_bt . ' | '; } } else { if ($quantity_rule['start_range'] == $quantity_rule['end_range']) { if ( $value_display == 'discount_both' ) { $table .= '
| ' . $quantity_rule['start_range'] . ' | ' . $discounted_new_price . ' | ' . $discounted_new_price_bt . ' | ||||||
| ' . $quantity_rule['start_range'] . ' | ' . $discounted_new_price . ' | |||||||
| ' . $quantity_rule['start_range'] . ' - ' . $quantity_rule['end_range'] . ' | ' . $discounted_new_price . ' | ' . $discounted_new_price_bt . ' | ||||||
| ' . $quantity_rule['start_range'] . ' - ' . $quantity_rule['end_range'] . ' | ' . $discounted_new_price . ' | |||||||
| ' . $quantity_rule['start_range'] . ' + | ' . $discounted_new_price . ' | ' . $discounted_new_price_bt . ' | ||||||
| ' . $quantity_rule['start_range'] . ' + | ' . $discounted_new_price . ' |
*'.$discount_description.'
' : '*'.$awdp_qn_label.' refers to discounted items (products with discount) individual count on cart.
| ' . $awdp_qn_label . ' | '; $tr_pr = '|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ' . $awdp_pc_label . ' | '; if ( $value_display == 'discount_both' ) { $tr_nw = '|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ' . $awdp_nw_label . ' | '; } } else { if ( $value_display == 'discount_both' ) { $table = '
| ' . $awdp_qn_label . '*' . ' | ' . $awdp_pc_label . ' | ' . $awdp_nw_label . ' |
| ' . $awdp_qn_label . ' | ' . $awdp_pc_label . ' | ' . $quantity_rule['start_range'] . ' | '; } else if ($quantity_rule['end_range']) { $tr_qn .= '' . $quantity_rule['start_range'] . ' - ' . $quantity_rule['end_range'] . ' | '; } else { $tr_qn .= '' . $quantity_rule['start_range'] . ' + | '; } if ( $value_display == 'discount_value' ) { if ($discount_typ == 'percentage') { $tr_pr .= '' .(float)$discount_val . $prcn_text . ' | '; } else if ($discount_typ == 'fixed') { $tr_pr .= '' . wc_price((float)$discount_val) . $fxd_text_two . ' | '; } } else if ( $value_display == 'discount_both' ) { // Display Both Price and Value if ($discount_typ == 'percentage') { $tr_pr .= '' .(float)$discount_val . $prcn_text . ' | '; } else if ($discount_typ == 'fixed') { $tr_pr .= '' . wc_price((float)$discount_val) . $fxd_text_two . ' | '; } if ( $discounted_new_min_price == $discounted_new_max_price ) { $tr_nw .= '' . $discounted_new_min_price . ' | '; } else { $tr_nw .= '' . $discounted_new_min_price . ' - ' . $discounted_new_max_price . ' | '; } } else { if ( $discounted_new_min_price == $discounted_new_max_price ) { $tr_pr .= '' . $discounted_new_min_price . ' | '; } else { $tr_pr .= '' . $discounted_new_min_price . ' - ' . $discounted_new_max_price . ' | '; } } } else { if ( $quantity_rule['start_range'] == $quantity_rule['end_range'] ) { $table .= '
| ' . $quantity_rule['start_range'] . ' | '; if ( $value_display == 'discount_value' ) { if ($discount_typ == 'percentage') { $table .= '' .(float)$discount_val . $prcn_text . ' | '; } else if ($discount_typ == 'fixed') { $table .= '' . wc_price((float)$discount_val) . $fxd_text_two . ' | '; } } else if ( $value_display == 'discount_both' ) { if ( $discount_typ == 'percentage' ) { $table .= '' .(float)$discount_val . $prcn_text . ' | '; } else if ($discount_typ == 'fixed') { $table .= '' . wc_price((float)$discount_val) . $fxd_text_two . ' | '; } if ( $discounted_new_min_price == $discounted_new_max_price ) { $table .= '' . $discounted_new_min_price . ' | '; } else { $table .= '' . $discounted_new_min_price . ' - ' . $discounted_new_max_price . ' | '; } } else { if ( $discounted_new_min_price == $discounted_new_max_price ) { $table .= '' . $discounted_new_min_price . ' | '; } else { $table .= '' . $discounted_new_min_price . ' - ' . $discounted_new_max_price . ' | '; } } $table .= '
| ' . $quantity_rule['start_range'] . ' - ' . $quantity_rule['end_range'] . ' | '; if ( $value_display == 'discount_value' ) { if ($discount_typ == 'percentage') { $table .= '' .(float)$discount_val . $prcn_text . ' | '; } else if ($discount_typ == 'fixed') { $table .= '' . wc_price((float)$discount_val) . $fxd_text_two . ' | '; } } else if ( $value_display == 'discount_both' ) { if ( $discount_typ == 'percentage' ) { $table .= '' .(float)$discount_val . $prcn_text . ' | '; } else if ($discount_typ == 'fixed') { $table .= '' . wc_price((float)$discount_val) . $fxd_text_two . ' | '; } if ( $discounted_new_min_price == $discounted_new_max_price ) { $table .= '' . $discounted_new_min_price . ' | '; } else { $table .= '' . $discounted_new_min_price . ' - ' . $discounted_new_max_price . ' | '; } } else { if ( $discounted_new_min_price == $discounted_new_max_price ) { $table .= '' . $discounted_new_min_price . ' | '; } else { $table .= '' . $discounted_new_min_price . ' - ' . $discounted_new_max_price . ' | '; } } $table .= '
| ' . $quantity_rule['start_range'] . ' + | '; if ( $value_display == 'discount_value' ) { if ($discount_typ == 'percentage') { $table .= '' .(float)$discount_val . $prcn_text . ' | '; } else if ($discount_typ == 'fixed') { $table .= '' . wc_price((float)$discount_val) . $fxd_text_two . ' | '; } } else if ( $value_display == 'discount_both' ) { if ($discount_typ == 'percentage') { $table .= '' .(float)$discount_val . $prcn_text . ' | '; } else if ($discount_typ == 'fixed') { $table .= '' . wc_price((float)$discount_val) . $fxd_text_two . ' | '; } if ($discounted_new_min_price == $discounted_new_max_price) { $table .= '' . $discounted_new_min_price . ' | '; } else { $table .= '' . $discounted_new_min_price . ' - ' . $discounted_new_max_price . ' | '; } } else { if ($discounted_new_min_price == $discounted_new_max_price) { $table .= '' . $discounted_new_min_price . ' | '; } else { $table .= '' . $discounted_new_min_price . ' - ' . $discounted_new_max_price . ' | '; } } $table .= '' . $quantity_rule['start_range'] . ' | '; } else if ($quantity_rule['end_range']) { $tr_qn .= '' . $quantity_rule['start_range'] . ' - ' . $quantity_rule['end_range'] . ' | '; } else { $tr_qn .= '' . $quantity_rule['start_range'] . ' + | '; } $tr_pr .= '' . $discounted_new_price . ' | '; if ( $value_display == 'discount_both' ) { $tr_nw .= '' . $discounted_new_price_bt . ' | '; } } else { if ($quantity_rule['start_range'] == $quantity_rule['end_range']) { if ( $value_display == 'discount_both' ) { $table .= '
| ' . $quantity_rule['start_range'] . ' | ' . $discounted_new_price . ' | ' . $discounted_new_price_bt . ' | ||||||
| ' . $quantity_rule['start_range'] . ' | ' . $discounted_new_price . ' | |||||||
| ' . $quantity_rule['start_range'] . ' - ' . $quantity_rule['end_range'] . ' | ' . $discounted_new_price . ' | ' . $discounted_new_price_bt . ' | ||||||
| ' . $quantity_rule['start_range'] . ' - ' . $quantity_rule['end_range'] . ' | ' . $discounted_new_price . ' | |||||||
| ' . $quantity_rule['start_range'] . ' + | ' . $discounted_new_price . ' | ' . $discounted_new_price_bt . ' | ||||||
| ' . $quantity_rule['start_range'] . ' + | ' . $discounted_new_price . ' |
*'.$discount_item_description.'
' : '*'.$awdp_qn_label.' refers to discounted items (products with discount) total quantity on cart.
'; // Pricinig Table if ($rule['pricing_table'] == 1 && $pricing_table_price > 0) $this->pricing_table[$item->get_id()][$rule['id']] = $table; // Discount if ($cart_total > 0) { $this->wdpCartDicount[$rule['id']] = (float)$discount_amt; $this->wdpCartDiscountValues[$rule['id']]['type'] = $disc_act_type; // $this->wdpCartDiscountValues[$rule['id']]['calc'] = $disc_calc_type; $this->wdpCartDiscountValues[$rule['id']]['quantity'] = $wdp_cart_quantity; $this->wdpCartDiscountValues[$rule['id']]['items_count'] = $wdp_cart_items; $this->wdpCartDiscountValues[$rule['id']]['value'] = $disc_act_val; $this->wdpCartDiscountValues[$rule['id']]['products'] = $wdp_applicable_ids; } // End Total Cart Quantity /////////////////////////////////////////////////////////////// } else if ( $quantity_type == 'type_product' ) { // Product Quantity Discount if (WC()->cart) { $cart_contents = WC()->cart->get_cart(); } else { $cart_contents = []; } $prod_QNT = []; $prod_QNTIDs = []; $item_id = $item->get_ID(); if ($cart_contents) { foreach ($cart_contents as $cart_content) { $cartData = $cart_content['data']->get_data(); // $cartPID = $cartData['parent_id']; $cartPSlug = $cartData['slug']; $cart_id = $cart_content['data']->get_ID(); // if ($item_id == $cart_id) // if( $cartPID != 0 && $variation_check ) { // $varProduct = new WC_Product_Variable( $parentID ); // $varIDs = $varProduct->get_children(); // foreach ( $varIDs as $varID ) { // $varSlug = get_post_field( 'post_name', $varID ); // $act_qnty += $prod_QNT[$varSlug]; // } // $prod_QNT[$cart_content['data']->get_data()['slug']] = $cart_content['quantity']; // } else { $prod_QNT[$cartPSlug] = $cart_content['quantity']; $prod_QNTIDs[$cart_id] = $cart_content['quantity']; // } } } // $variation_check // added @ ver 3.4.5 if ( $variation_check ) { if ( $item->is_type('variable') ) { $varProduct = new WC_Product_Variable( $item_id ); $varIDs = $varProduct->get_children(); foreach ( $varIDs as $varID ) { $act_qnty += $prod_QNTIDs[$varID]; } } else if ( $item->parent_id != 0 ) { $parentID = $item->parent_id; $varProduct = new WC_Product_Variable( $parentID ); $varIDs = $varProduct->get_children(); foreach ( $varIDs as $varID ) { $act_qnty += $prod_QNTIDs[$varID]; } } else { $act_qnty = $prod_QNT[$prod_ID]; } $prod_QNT[$prod_ID] = $act_qnty; } if ($table_layout == 'horizontal') { $table = '| ' . $awdp_qn_label . ' | '; $tr_pr = '|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ' . $awdp_pc_label . ' | '; if ( $value_display == 'discount_both' ) { $tr_nw = '|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ' . $awdp_nw_label . ' | '; } } else { if ( $value_display == 'discount_both' ) { $table = '
| ' . $awdp_qn_label . '*' . ' | ' . $awdp_pc_label . ' | ' . $awdp_nw_label . ' |
| ' . $awdp_qn_label . ' | ' . $awdp_pc_label . ' | ' . $quantity_rule['start_range'] . ' | '; } else if ($quantity_rule['end_range']) { $tr_qn .= '' . $quantity_rule['start_range'] . ' - ' . $quantity_rule['end_range'] . ' | '; } else { $tr_qn .= '' . $quantity_rule['start_range'] . ' + | '; } if ( $value_display == 'discount_value' ) { if ($discount_typ == 'percentage') { $tr_pr .= '' .(float)$discount_val . $prcn_text . ' | '; } else if ($discount_typ == 'fixed') { $tr_pr .= '' . wc_price((float)$discount_val) . $fxd_text_two . ' | '; } } else if ( $value_display == 'discount_both' ) { // Display Both Price and Value if ($discount_typ == 'percentage') { $tr_pr .= '' .(float)$discount_val . $prcn_text . ' | '; } else if ($discount_typ == 'fixed') { $tr_pr .= '' . wc_price((float)$discount_val) . $fxd_text_two . ' | '; } if ( $discounted_new_min_price == $discounted_new_max_price ) { $tr_nw .= '' . $discounted_new_min_price . ' | '; } else { $tr_nw .= '' . $discounted_new_min_price . ' - ' . $discounted_new_max_price . ' | '; } } else { if ( $discounted_new_min_price == $discounted_new_max_price ) { $tr_pr .= '' . $discounted_new_min_price . ' | '; } else { $tr_pr .= '' . $discounted_new_min_price . ' - ' . $discounted_new_max_price . ' | '; } } } else { if ( $quantity_rule['start_range'] == $quantity_rule['end_range'] ) { $table .= '
| ' . $quantity_rule['start_range'] . ' | '; if ( $value_display == 'discount_value' ) { if ($discount_typ == 'percentage') { $table .= '' .(float)$discount_val . $prcn_text . ' | '; } else if ($discount_typ == 'fixed') { $table .= '' . wc_price((float)$discount_val) . $fxd_text_two . ' | '; } } else if ( $value_display == 'discount_both' ) { if ( $discount_typ == 'percentage' ) { $table .= '' .(float)$discount_val . $prcn_text . ' | '; } else if ($discount_typ == 'fixed') { $table .= '' . wc_price((float)$discount_val) . $fxd_text_two . ' | '; } if ( $discounted_new_min_price == $discounted_new_max_price ) { $table .= '' . $discounted_new_min_price . ' | '; } else { $table .= '' . $discounted_new_min_price . ' - ' . $discounted_new_max_price . ' | '; } } else { if ( $discounted_new_min_price == $discounted_new_max_price ) { $table .= '' . $discounted_new_min_price . ' | '; } else { $table .= '' . $discounted_new_min_price . ' - ' . $discounted_new_max_price . ' | '; } } $table .= '
| ' . $quantity_rule['start_range'] . ' - ' . $quantity_rule['end_range'] . ' | '; if ( $value_display == 'discount_value' ) { if ($discount_typ == 'percentage') { $table .= '' .(float)$discount_val . $prcn_text . ' | '; } else if ($discount_typ == 'fixed') { $table .= '' . wc_price((float)$discount_val) . $fxd_text_two . ' | '; } } else if ( $value_display == 'discount_both' ) { if ( $discount_typ == 'percentage' ) { $table .= '' .(float)$discount_val . $prcn_text . ' | '; } else if ($discount_typ == 'fixed') { $table .= '' . wc_price((float)$discount_val) . $fxd_text_two . ' | '; } if ( $discounted_new_min_price == $discounted_new_max_price ) { $table .= '' . $discounted_new_min_price . ' | '; } else { $table .= '' . $discounted_new_min_price . ' - ' . $discounted_new_max_price . ' | '; } } else { if ( $discounted_new_min_price == $discounted_new_max_price ) { $table .= '' . $discounted_new_min_price . ' | '; } else { $table .= '' . $discounted_new_min_price . ' - ' . $discounted_new_max_price . ' | '; } } $table .= '
| ' . $quantity_rule['start_range'] . ' + | '; if ( $value_display == 'discount_value' ) { if ($discount_typ == 'percentage') { $table .= '' .(float)$discount_val . $prcn_text . ' | '; } else if ($discount_typ == 'fixed') { $table .= '' . wc_price((float)$discount_val) . $fxd_text_two . ' | '; } } else if ( $value_display == 'discount_both' ) { if ($discount_typ == 'percentage') { $table .= '' .(float)$discount_val . $prcn_text . ' | '; } else if ($discount_typ == 'fixed') { $table .= '' . wc_price((float)$discount_val) . $fxd_text_two . ' | '; } if ($discounted_new_min_price == $discounted_new_max_price) { $table .= '' . $discounted_new_min_price . ' | '; } else { $table .= '' . $discounted_new_min_price . ' - ' . $discounted_new_max_price . ' | '; } } else { if ($discounted_new_min_price == $discounted_new_max_price) { $table .= '' . $discounted_new_min_price . ' | '; } else { $table .= '' . $discounted_new_min_price . ' - ' . $discounted_new_max_price . ' | '; } } $table .= '' . $quantity_rule['start_range'] . ' | '; } else if ($quantity_rule['end_range']) { $tr_qn .= '' . $quantity_rule['start_range'] . ' - ' . $quantity_rule['end_range'] . ' | '; } else { $tr_qn .= '' . $quantity_rule['start_range'] . ' + | '; } $tr_pr .= '' . $discounted_new_price . ' | '; if ( $value_display == 'discount_both' ) { $tr_nw .= '' . $discounted_new_price_bt . ' | '; } } else { if ($quantity_rule['start_range'] == $quantity_rule['end_range']) { if ( $value_display == 'discount_both' ) { $table .= '
| ' . $quantity_rule['start_range'] . ' | ' . $discounted_new_price . ' | ' . $discounted_new_price_bt . ' | ||||||
| ' . $quantity_rule['start_range'] . ' | ' . $discounted_new_price . ' | |||||||
| ' . $quantity_rule['start_range'] . ' - ' . $quantity_rule['end_range'] . ' | ' . $discounted_new_price . ' | ' . $discounted_new_price_bt . ' | ||||||
| ' . $quantity_rule['start_range'] . ' - ' . $quantity_rule['end_range'] . ' | ' . $discounted_new_price . ' | |||||||
| ' . $quantity_rule['start_range'] . ' + | ' . $discounted_new_price . ' | ' . $discounted_new_price_bt . ' | ||||||
| ' . $quantity_rule['start_range'] . ' + | ' . $discounted_new_price . ' |