← All changes
|
src/Settings/Sections/GeneralSection/Subsections/ProductPagePriceSubsection.php
+30
-13
6.5.0
→
8.0.2
View file →
| @@ -8,9 +8,9 @@ | ||
| 8 | 8 | |
| 9 | 9 | class ProductPagePriceSubsection extends SubsectionAbstract { |
| 10 | 10 | |
| 11 | 11 | public function getTitle(): string { |
| 12 | - return __( 'Product Page Pricing', 'tier-pricing-table' ); | |
| 12 | + return __( 'Single Product Page Pricing', 'tier-pricing-table' ); | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | public function getDescription(): string { |
| 16 | 16 | return __( 'Manage how tiered prices are displayed and behave on single product pages.', |
| @@ -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', |
| @@ -27,38 +31,51 @@ | ||
| 27 | 31 | 'title' => __( 'Price display format', 'tier-pricing-table' ), |
| 28 | 32 | 'id' => Settings::SETTINGS_PREFIX . 'product_page_price_format', |
| 29 | 33 | 'type' => TPTDisplayType::FIELD_TYPE, |
| 30 | 34 | 'options' => array( |
| 31 | - 'same_as_catalog' => __( 'Match catalog display (price range or lowest price)', 'tier-pricing-table' ), | |
| 32 | - 'custom' => __( 'Dynamic', 'tier-pricing-table' ), | |
| 35 | + 'same_as_catalog' => __( 'Match Shop & Categories display (price range or lowest price)', 'tier-pricing-table' ), | |
| 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( |
| 38 | - 'title' => __( 'Enable dynamic price updates', 'tier-pricing-table' ), | |
| 48 | + 'title' => __( 'Update price on quantity change', 'tier-pricing-table' ), | |
| 39 | 49 | 'id' => Settings::SETTINGS_PREFIX . 'update_price_on_product_page', |
| 40 | 50 | 'type' => TPTSwitchOption::FIELD_TYPE, |
| 41 | 51 | 'default' => 'yes', |
| 42 | - 'desc' => __( 'Automatically update the main product price when a user selects a different quantity.', | |
| 52 | + 'desc' => __( 'Automatically update the main product price whenever a customer changes the quantity input.', | |
| 43 | 53 | 'tier-pricing-table' ), |
| 44 | 54 | ), |
| 45 | 55 | array( |
| 46 | - 'title' => __( 'Display tiered price as discount', 'tier-pricing-table' ), | |
| 56 | + 'title' => __( 'Show original price crossed out', 'tier-pricing-table' ), | |
| 47 | 57 | 'id' => Settings::SETTINGS_PREFIX . 'show_tiered_price_as_discount', |
| 48 | 58 | 'type' => TPTSwitchOption::FIELD_TYPE, |
| 49 | 59 | 'default' => 'yes', |
| 50 | - 'desc' => __( 'Cross out the original price and show the discounted tiered price next to it.', | |
| 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' => __( 'Display total price', 'tier-pricing-table' ), | |
| 55 | - 'id' => Settings::SETTINGS_PREFIX . 'show_total_price', | |
| 56 | - 'type' => TPTSwitchOption::FIELD_TYPE, | |
| 57 | - 'default' => 'no', | |
| 58 | - 'desc' => __( 'Show the total calculated price based on the selected quantity and active tier.', | |
| 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 ], | |
| 70 | + ), | |
| 71 | + array( | |
| 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.', | |
| 77 | + 'tier-pricing-table' ), | |
| 61 | 78 | ), |
| 62 | 79 | ); |
| 63 | 80 | } |
| 64 | 81 | |