← All changes
|
src/Settings/Sections/GeneralSection/Subsections/ProductPagePriceSubsection.php
+20
-12
7.1.1
→
8.0.2
View file →
| @@ -21,8 +21,12 @@ | ||
| 21 | 21 | return 'product_page_price'; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | public function getSettings(): array { |
| 25 | + $price = function ( $amount ) { | |
| 26 | + return wp_strip_all_tags( wc_price( $amount ) ); | |
| 27 | + }; | |
| 28 | + | |
| 25 | 29 | return array( |
| 26 | 30 | array( |
| 27 | 31 | 'title' => __( 'Price display format', 'tier-pricing-table' ), |
| 28 | 32 | 'id' => Settings::SETTINGS_PREFIX . 'product_page_price_format', |
| @@ -30,8 +34,14 @@ | ||
| 30 | 34 | 'options' => array( |
| 31 | 35 | 'same_as_catalog' => __( 'Match Shop & Categories display (price range or lowest price)', 'tier-pricing-table' ), |
| 32 | 36 | 'custom' => __( 'Actual price for selected quantity', 'tier-pricing-table' ), |
| 33 | 37 | ), |
| 38 | + 'descriptions' => array( | |
| 39 | + /* translators: %s: example price */ | |
| 40 | + 'same_as_catalog' => sprintf( __( 'e.g. "From %s" or a price range, as on the shop page', 'tier-pricing-table' ), $price( 10 ) ), | |
| 41 | + /* translators: %s: example price */ | |
| 42 | + 'custom' => sprintf( __( 'e.g. %s when 50 pieces are selected', 'tier-pricing-table' ), $price( 12 ) ), | |
| 43 | + ), | |
| 34 | 44 | 'default' => ServiceContainer::getInstance()->getSettings()->get( 'tiered_price_at_product_page', |
| 35 | 45 | 'no' ) === 'yes' ? 'same_as_catalog' : 'custom', |
| 36 | 46 | ), |
| 37 | 47 | array( |
| @@ -50,24 +60,22 @@ | ||
| 50 | 60 | 'desc' => __( 'Cross out the regular price and show the discounted tiered price next to it when a higher quantity is selected.', |
| 51 | 61 | 'tier-pricing-table' ), |
| 52 | 62 | ), |
| 53 | 63 | array( |
| 54 | - 'title' => __( 'Show total price (Price × Quantity)', 'tier-pricing-table' ), | |
| 55 | - 'id' => Settings::SETTINGS_PREFIX . 'show_total_price', | |
| 56 | - 'type' => TPTSwitchOption::FIELD_TYPE, | |
| 57 | - 'default' => 'no', | |
| 58 | - 'desc' => __( 'Multiply the main product price by the selected quantity instead of showing the per-item price.', | |
| 64 | + 'title' => __( 'Show total price (Price × Quantity)', 'tier-pricing-table' ), | |
| 65 | + 'id' => Settings::SETTINGS_PREFIX . 'show_total_price', | |
| 66 | + 'type' => TPTSwitchOption::FIELD_TYPE, | |
| 67 | + 'default' => 'no', | |
| 68 | + 'desc' => __( 'Multiply the main product price by the selected quantity instead of showing the per-item price.', | |
| 59 | 69 | 'tier-pricing-table' ), |
| 60 | - 'custom_attributes' => [ 'data-tiered-pricing-premium-option' => true ], | |
| 61 | 70 | ), |
| 62 | 71 | array( |
| 63 | - 'title' => __( 'Show total price for non-tiered products', 'tier-pricing-table' ), | |
| 64 | - 'id' => Settings::SETTINGS_PREFIX . 'show_total_price_non_tiered', | |
| 65 | - 'type' => TPTSwitchOption::FIELD_TYPE, | |
| 66 | - 'default' => 'no', | |
| 67 | - 'desc' => __( 'Multiply the price by quantity even if the product has no tiered pricing rules.', | |
| 72 | + 'title' => __( 'Show total price for non-tiered products', 'tier-pricing-table' ), | |
| 73 | + 'id' => Settings::SETTINGS_PREFIX . 'show_total_price_non_tiered', | |
| 74 | + 'type' => TPTSwitchOption::FIELD_TYPE, | |
| 75 | + 'default' => 'no', | |
| 76 | + 'desc' => __( 'Multiply the price by quantity even if the product has no tiered pricing rules.', | |
| 68 | 77 | 'tier-pricing-table' ), |
| 69 | - 'custom_attributes' => [ 'data-tiered-pricing-premium-option' => true ], | |
| 70 | 78 | ), |
| 71 | 79 | ); |
| 72 | 80 | } |
| 73 | 81 | |