PluginProbe
Tiered Pricing Table for WooCommerce / 2.2.2
Tiered Pricing Table for WooCommerce v2.2.2
7.1.7 7.1.5 7.1.4 7.1.1 6.5.0 6.4.0 6.1.0 trunk 1.0 1.1 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 All 90 releases
← All changes | src/PriceManager.php +4 -21 2.3.22.2.2 View file →
@@ -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,14 @@
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 ), [
69 + return wc_get_price_to_display( wc_get_product( $product_id ), [
76 70 'price' => $price,
77 71 'qty' => 1,
78 72 ] );
79 - break;
80 73 }
81 -
82 74 }
83 75 }
84 76
85 77 if ( $type === 'percentage' ) {
@@ -84,27 +76,18 @@
84 76
85 77 if ( $type === 'percentage' ) {
86 78 $product = wc_get_product( $product_id );
87 79 foreach ( array_reverse( $rules, true ) as $_amount => $percentDiscount ) {
88 -
89 80 if ( $_amount <= $quantity ) {
90 - $product_price = wc_get_price_to_display( $product, [
81 + return wc_get_price_to_display( $product, [
91 82 'price' => self::getPriceByPercentDiscount( $product->get_price(), $percentDiscount ),
92 83 'qty' => 1,
93 84 ] );
94 - break;
95 85 }
96 -
97 86 }
98 87 }
99 88
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 - );
89 + return false;
107 90 }
108 91
109 92 /**
110 93 * Calculate price using percentage discount