← All changes
|
src/Addons/TieredPricingCart/CartOptionsSubsection.php
+24
-0
7.1.4
→
8.0.2
View file →
| @@ -43,9 +43,33 @@ | ||
| 43 | 43 | 'tier-pricing-table' ), |
| 44 | 44 | 'type' => TPTSwitchOption::FIELD_TYPE, |
| 45 | 45 | 'default' => 'no', |
| 46 | 46 | ), |
| 47 | + array( | |
| 48 | + 'title' => __( 'Show a total savings row', 'tier-pricing-table' ), | |
| 49 | + 'id' => Settings::SETTINGS_PREFIX . 'cart_total_savings', | |
| 50 | + 'desc' => __( 'A row in the cart totals and in the classic checkout\'s order review with the amount the tiered prices take off the cart. Not available with the Checkout block.', 'tier-pricing-table' ), | |
| 51 | + 'type' => TPTSwitchOption::FIELD_TYPE, | |
| 52 | + 'default' => 'no', | |
| 53 | + ), | |
| 54 | + array( | |
| 55 | + 'title' => __( 'Total savings row label', 'tier-pricing-table' ), | |
| 56 | + 'id' => Settings::SETTINGS_PREFIX . 'cart_total_savings_label', | |
| 57 | + 'type' => 'text', | |
| 58 | + 'default' => __( 'Total savings', 'tier-pricing-table' ), | |
| 59 | + 'css' => 'width: 20em;', | |
| 60 | + ), | |
| 47 | 61 | ); |
| 62 | + } | |
| 63 | + | |
| 64 | + public static function showTotalSavings(): bool { | |
| 65 | + return get_option( Settings::SETTINGS_PREFIX . 'cart_total_savings', 'no' ) === 'yes'; | |
| 66 | + } | |
| 67 | + | |
| 68 | + public static function getTotalSavingsLabel(): string { | |
| 69 | + $label = (string) get_option( Settings::SETTINGS_PREFIX . 'cart_total_savings_label', '' ); | |
| 70 | + | |
| 71 | + return '' !== trim( $label ) ? $label : __( 'Total savings', 'tier-pricing-table' ); | |
| 48 | 72 | } |
| 49 | 73 | |
| 50 | 74 | |
| 51 | 75 | /** |