PluginProbe
Tiered Pricing Table for WooCommerce / trunk
Tiered Pricing Table for WooCommerce vtrunk
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
tier-pricing-table / src / CalculationLogic.php

CalculationLogic.php in Tiered Pricing Table for WooCommerce trunk, at src/CalculationLogic.php

61 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace TierPricingTable;
2
3 use TierPricingTable\Settings\Settings;
4
5 class CalculationLogic {
6
7 /**
8 * If product is on sale, calculate the discount based on the sale or regular price
9 *
10 * @return bool
11 */
12 public static function calculateDiscountBasedOnRegularPrice(): bool {
13 return get_option( Settings::SETTINGS_PREFIX . 'calculate_discount_based_on_regular_price', 'no' ) === 'yes';
14 }
15
16 /**
17 * Consider all variations from the same product as the same product, when tiered pricing calculates the price for a variation
18 *
19 * @return bool
20 */
21 public static function considerProductVariationAsOneProduct(): bool {
22 return get_option( Settings::SETTINGS_PREFIX . 'summarize_variations', 'no' ) === 'yes';
23 }
24
25 /**
26 * Round the final price, when tiered pricing calculates a percentage discount
27 *
28 * @return bool
29 */
30 public static function roundPrice(): bool {
31 return get_option( Settings::SETTINGS_PREFIX . 'round_price', 'yes' ) === 'yes';
32 }
33
34 /**
35 * Do global pricing rules have a higher priority than product level rules.
36 *
37 * @return bool
38 */
39 public static function globalRulesOverrideProductLevelRules(): bool {
40 return get_option( Settings::SETTINGS_PREFIX . 'override_prices_by_global_rules', 'no' ) === 'yes';
41 }
42
43 /**
44 * When cart item has a tiered price, show it as a discount with the original price crossed out.
45 *
46 * @return bool
47 */
48 public static function showTieredPriceInCartAsDiscount(): bool {
49 return get_option( Settings::SETTINGS_PREFIX . 'show_discount_in_cart', 'yes' ) === 'yes';
50 }
51
52 /**
53 * Mix and match minimum order quantity for variable products
54 *
55 * @return bool
56 */
57 public static function isMixAndMatchMinimumEnabled(): bool {
58 return get_option( Settings::SETTINGS_PREFIX . 'mix_and_match_minimum', 'no' ) === 'yes';
59 }
60 }
61