PluginProbe
Tiered Pricing Table for WooCommerce / 8.0.2
Tiered Pricing Table for WooCommerce v8.0.2
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 2.3.3 All 91 releases
← All changes | src/Addons/CatalogPrices/CatalogPricesSubsection.php +50 -10 6.4.0 → 8.0.2 View file →
@@ -7,14 +7,16 @@
7 7
8 8 class CatalogPricesSubsection extends SubsectionAbstract {
9 9
10 10 public function getTitle(): string {
11 - return __( 'Catalog Price Format',
11 + add_filter( 'tiered_pricing_table/text_template_variables', array( $this, 'registerTemplateVariables' ) );
12 +
13 + return __( 'Shop & Categories Price Format',
12 14 'tier-pricing-table' );
13 15 }
14 16
15 17 public function getDescription(): string {
16 - return __( 'Manage how tiered pricing appears in catalogs, loops, and widgets.',
18 + return __( 'Manage how the main product price string is formatted in shop pages, categories, and widgets.',
17 19 'tier-pricing-table' );
18 20 }
19 21
20 22 public function getSlug(): string {
@@ -23,39 +25,57 @@
23 25
24 26 public function getSettings(): array {
25 27 return array(
26 28 array(
27 - 'title' => __( 'Enable tiered format', 'tier-pricing-table' ),
29 + 'title' => __( 'Override default price display', 'tier-pricing-table' ),
28 30 'id' => Settings::SETTINGS_PREFIX . 'tiered_price_at_catalog',
29 31 'type' => TPTSwitchOption::FIELD_TYPE,
30 32 'default' => 'yes',
31 - 'desc' => __( 'Display the lowest tiered price or a price range instead of the standard product price.',
33 + 'desc' => __( 'Replace the standard WooCommerce price with a custom lowest price or price range.',
32 34 'tier-pricing-table' ),
33 35 'desc_tip' => true,
34 36 ),
35 37 array(
36 - 'title' => __( 'Enable for variable products', 'tier-pricing-table' ),
38 + 'title' => __( 'Apply to variable products', 'tier-pricing-table' ),
37 39 'id' => Settings::SETTINGS_PREFIX . 'tiered_price_at_catalog_for_variable',
38 40 'type' => TPTSwitchOption::FIELD_TYPE,
39 41 'default' => 'no',
40 - 'desc' => __( 'Apply the tiered format to variable products, using the lowest and highest prices across all variations.',
42 + 'desc' => __( 'Calculate the lowest and highest prices across all variations and display them using your chosen format.',
41 43 'tier-pricing-table' ),
42 44 'desc_tip' => true,
43 45 ),
44 46 array(
45 - 'title' => __( 'Display format', 'tier-pricing-table' ),
47 + 'title' => __( 'Format style', 'tier-pricing-table' ),
46 48 'id' => Settings::SETTINGS_PREFIX . 'tiered_price_at_catalog_type',
47 49 'type' => TPTDisplayType::FIELD_TYPE,
48 50 'options' => [
49 51 'lowest' => __( 'Show lowest price', 'tier-pricing-table' ),
50 52 'range' => __( 'Show range (lowest to highest)', 'tier-pricing-table' ),
53 + 'custom' => __( 'Custom template', 'tier-pricing-table' ),
51 54 ],
55 + 'descriptions' => [
56 + /* translators: %s: example price */
57 + 'lowest' => sprintf( __( 'e.g. From %s', 'tier-pricing-table' ), wp_strip_all_tags( wc_price( 10 ) ) ),
58 + /* translators: 1: lowest example price, 2: highest example price */
59 + 'range' => sprintf( __( 'e.g. %1$s - %2$s', 'tier-pricing-table' ), wp_strip_all_tags( wc_price( 10 ) ), wp_strip_all_tags( wc_price( 18 ) ) ),
60 + 'custom' => __( 'Your own text built from the variables below', 'tier-pricing-table' ),
61 + ],
52 62 'default' => 'lowest',
53 - 'desc' => __( 'Choose whether to show only the lowest available price or the full price range.', 'tier-pricing-table' ),
54 - 'desc_tip' => true,
55 63 ),
56 64 array(
57 - 'title' => __( 'Lowest price prefix', 'tier-pricing-table' ),
65 + 'title' => __( 'Custom template', 'tier-pricing-table' ),
66 + 'id' => Settings::SETTINGS_PREFIX . 'tiered_price_at_catalog_custom_template',
67 + 'type' => \TierPricingTable\Settings\CustomOptions\TPTTextTemplate::FIELD_TYPE,
68 + 'default' => __( 'From {tp_lowest_price} instead of {tp_original_price}', 'tier-pricing-table' ),
69 + 'desc' => __( 'Create a custom template for catalog prices. Use the available variables below to dynamically insert the lowest price, price range, or original product price.', 'tier-pricing-table' ),
70 + 'placeholders' => array(
71 + 'tp_lowest_price',
72 + 'tp_prices_range',
73 + 'tp_original_price',
74 + ),
75 + ),
76 + array(
77 + 'title' => __( 'Prefix for lowest price', 'tier-pricing-table' ),
58 78 'id' => Settings::SETTINGS_PREFIX . 'lowest_prefix',
59 79 'type' => 'text',
60 80 'default' => __( 'From', 'tier-pricing-table' ),
61 81 'desc' => __( 'Text displayed before the lowest price (e.g., <b>From $10.00</b>).',
@@ -61,6 +81,26 @@
61 81 'desc' => __( 'Text displayed before the lowest price (e.g., <b>From $10.00</b>).',
62 82 'tier-pricing-table' ),
63 83 ),
64 84 );
85 + }
86 +
87 + public function registerTemplateVariables( $variables ) {
88 + $variables['tp_lowest_price'] = array(
89 + 'name' => __( 'Lowest price', 'tier-pricing-table' ),
90 + 'description' => __( '{tp_lowest_price} - lowest available tier price.', 'tier-pricing-table' ),
91 + 'variableKey' => '{tp_lowest_price}',
92 + );
93 + $variables['tp_prices_range'] = array(
94 + 'name' => __( 'Prices range', 'tier-pricing-table' ),
95 + 'description' => __( '{tp_prices_range} - price range from lowest tier to original price.', 'tier-pricing-table' ),
96 + 'variableKey' => '{tp_prices_range}',
97 + );
98 + $variables['tp_original_price'] = array(
99 + 'name' => __( 'Original price', 'tier-pricing-table' ),
100 + 'description' => __( '{tp_original_price} - product\'s original price without discounts.', 'tier-pricing-table' ),
101 + 'variableKey' => '{tp_original_price}',
102 + );
103 +
104 + return $variables;
65 105 }
66 106 }