PluginProbe
Tiered Pricing Table for WooCommerce / 2.2.3
Tiered Pricing Table for WooCommerce v2.2.3
8.1.0 8.0.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 All 92 releases
← All changes | src/PriceManager.php +15 -4 2.1.1 → 2.2.3 View file →
@@ -47,9 +47,14 @@
47 47 }
48 48
49 49 $rules = ( !empty($rules) ? $rules : [] );
50 50 ksort( $rules );
51 - return $rules;
51 + return apply_filters(
52 + 'tier_pricing_table/price/product_price_rules',
53 + $rules,
54 + $product_id,
55 + $type
56 + );
52 57 }
53 58
54 59 /**
55 60 * Get price by product quantity
@@ -65,9 +70,9 @@
65 70 $type = self::getPricingType( $product_id );
66 71 if ( $type === 'fixed' ) {
67 72 foreach ( array_reverse( $rules, true ) as $_amount => $price ) {
68 73 if ( $_amount <= $quantity ) {
69 - return wc_get_price_to_display( wc_get_product( $product_id ), [
74 + $product_price = wc_get_price_to_display( wc_get_product( $product_id ), [
70 75 'price' => $price,
71 76 'qty' => 1,
72 77 ] );
73 78 }
@@ -77,9 +82,9 @@
77 82 if ( $type === 'percentage' ) {
78 83 $product = wc_get_product( $product_id );
79 84 foreach ( array_reverse( $rules, true ) as $_amount => $percentDiscount ) {
80 85 if ( $_amount <= $quantity ) {
81 - return wc_get_price_to_display( $product, [
86 + $product_price = wc_get_price_to_display( $product, [
82 87 'price' => self::getPriceByPercentDiscount( $product->get_price(), $percentDiscount ),
83 88 'qty' => 1,
84 89 ] );
85 90 }
@@ -85,9 +90,15 @@
85 90 }
86 91 }
87 92 }
88 93
89 - return false;
94 + $product_price = ( isset( $product_price ) ? $product_price : false );
95 + return apply_filters(
96 + 'tier_pricing_table/price/price_by_rules',
97 + $product_price,
98 + $quantity,
99 + $product_id
100 + );
90 101 }
91 102
92 103 /**
93 104 * Calculate price using percentage discount