| @@ -47,14 +47,9 @@ | ||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | $rules = ( !empty($rules) ? $rules : [] ); |
| 50 | 50 | ksort( $rules ); |
| 51 | - return apply_filters( | |
| 52 | - 'tier_pricing_table/price/product_price_rules', | |
| 53 | - $rules, | |
| 54 | - $product_id, | |
| 55 | - $type | |
| 56 | - ); | |
| 51 | + return $rules; | |
| 57 | 52 | } |
| 58 | 53 | |
| 59 | 54 | /** |
| 60 | 55 | * Get price by product quantity |
| @@ -69,17 +64,11 @@ | ||
| 69 | 64 | $rules = self::getPriceRules( $product_id ); |
| 70 | 65 | $type = self::getPricingType( $product_id ); |
| 71 | 66 | if ( $type === 'fixed' ) { |
| 72 | 67 | foreach ( array_reverse( $rules, true ) as $_amount => $price ) { |
| 73 | - | |
| 74 | 68 | if ( $_amount <= $quantity ) { |
| 75 | - $product_price = wc_get_price_to_display( wc_get_product( $product_id ), [ | |
| 76 | - 'price' => $price, | |
| 77 | - 'qty' => 1, | |
| 78 | - ] ); | |
| 79 | - break; | |
| 69 | + return $price; | |
| 80 | 70 | } |
| 81 | - | |
| 82 | 71 | } |
| 83 | 72 | } |
| 84 | 73 | |
| 85 | 74 | if ( $type === 'percentage' ) { |
| @@ -84,27 +73,15 @@ | ||
| 84 | 73 | |
| 85 | 74 | if ( $type === 'percentage' ) { |
| 86 | 75 | $product = wc_get_product( $product_id ); |
| 87 | 76 | foreach ( array_reverse( $rules, true ) as $_amount => $percentDiscount ) { |
| 88 | - | |
| 89 | 77 | if ( $_amount <= $quantity ) { |
| 90 | - $product_price = wc_get_price_to_display( $product, [ | |
| 91 | - 'price' => self::getPriceByPercentDiscount( $product->get_price(), $percentDiscount ), | |
| 92 | - 'qty' => 1, | |
| 93 | - ] ); | |
| 94 | - break; | |
| 78 | + return self::getPriceByPercentDiscount( $product->get_price(), $percentDiscount ); | |
| 95 | 79 | } |
| 96 | - | |
| 97 | 80 | } |
| 98 | 81 | } |
| 99 | 82 | |
| 100 | - $product_price = ( isset( $product_price ) ? $product_price : false ); | |
| 101 | - return apply_filters( | |
| 102 | - 'tier_pricing_table/price/price_by_rules', | |
| 103 | - $product_price, | |
| 104 | - $quantity, | |
| 105 | - $product_id | |
| 106 | - ); | |
| 83 | + return false; | |
| 107 | 84 | } |
| 108 | 85 | |
| 109 | 86 | /** |
| 110 | 87 | * Calculate price using percentage discount |