__( 'Override default price display', 'tier-pricing-table' ), 'id' => Settings::SETTINGS_PREFIX . 'tiered_price_at_catalog', 'type' => TPTSwitchOption::FIELD_TYPE, 'default' => 'yes', 'desc' => __( 'Replace the standard WooCommerce price with a custom lowest price or price range.', 'tier-pricing-table' ), 'desc_tip' => true, ), array( 'title' => __( 'Apply to variable products', 'tier-pricing-table' ), 'id' => Settings::SETTINGS_PREFIX . 'tiered_price_at_catalog_for_variable', 'type' => TPTSwitchOption::FIELD_TYPE, 'default' => 'no', 'desc' => __( 'Calculate the lowest and highest prices across all variations and display them using your chosen format.', 'tier-pricing-table' ), 'desc_tip' => true, ), array( 'title' => __( 'Format style', 'tier-pricing-table' ), 'id' => Settings::SETTINGS_PREFIX . 'tiered_price_at_catalog_type', 'type' => TPTDisplayType::FIELD_TYPE, 'options' => [ 'lowest' => __( 'Show lowest price', 'tier-pricing-table' ), 'range' => __( 'Show range (lowest to highest)', 'tier-pricing-table' ), 'custom' => __( 'Custom template', 'tier-pricing-table' ), ], 'descriptions' => [ /* translators: %s: example price */ 'lowest' => sprintf( __( 'e.g. From %s', 'tier-pricing-table' ), wp_strip_all_tags( wc_price( 10 ) ) ), /* translators: 1: lowest example price, 2: highest example price */ '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 ) ) ), 'custom' => __( 'Your own text built from the variables below', 'tier-pricing-table' ), ], 'default' => 'lowest', ), array( 'title' => __( 'Custom template', 'tier-pricing-table' ), 'id' => Settings::SETTINGS_PREFIX . 'tiered_price_at_catalog_custom_template', 'type' => \TierPricingTable\Settings\CustomOptions\TPTTextTemplate::FIELD_TYPE, 'default' => __( 'From {tp_lowest_price} instead of {tp_original_price}', 'tier-pricing-table' ), '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' ), 'placeholders' => array( 'tp_lowest_price', 'tp_prices_range', 'tp_original_price', ), ), array( 'title' => __( 'Prefix for lowest price', 'tier-pricing-table' ), 'id' => Settings::SETTINGS_PREFIX . 'lowest_prefix', 'type' => 'text', 'default' => __( 'From', 'tier-pricing-table' ), 'desc' => __( 'Text displayed before the lowest price (e.g., From $10.00).', 'tier-pricing-table' ), ), ); } public function registerTemplateVariables( $variables ) { $variables['tp_lowest_price'] = array( 'name' => __( 'Lowest price', 'tier-pricing-table' ), 'description' => __( '{tp_lowest_price} - lowest available tier price.', 'tier-pricing-table' ), 'variableKey' => '{tp_lowest_price}', ); $variables['tp_prices_range'] = array( 'name' => __( 'Prices range', 'tier-pricing-table' ), 'description' => __( '{tp_prices_range} - price range from lowest tier to original price.', 'tier-pricing-table' ), 'variableKey' => '{tp_prices_range}', ); $variables['tp_original_price'] = array( 'name' => __( 'Original price', 'tier-pricing-table' ), 'description' => __( '{tp_original_price} - product\'s original price without discounts.', 'tier-pricing-table' ), 'variableKey' => '{tp_original_price}', ); return $variables; } }