PluginProbe
Tiered Pricing Table for WooCommerce / 6.5.0
Tiered Pricing Table for WooCommerce v6.5.0
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
tier-pricing-table / src / Addons / TieredPricingCart / CartOptionsSubsection.php

CartOptionsSubsection.php in Tiered Pricing Table for WooCommerce 6.5.0, at src/Addons/TieredPricingCart/CartOptionsSubsection.php

69 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace TierPricingTable\Addons\TieredPricingCart;
2
3 use TierPricingTable\Settings\CustomOptions\TPTSwitchOption;
4 use TierPricingTable\Settings\Sections\SubsectionAbstract;
5 use TierPricingTable\Settings\Settings;
6
7 class CartOptionsSubsection extends SubsectionAbstract {
8
9 public function getTitle(): string {
10 return __( 'Cart Display Settings', 'tier-pricing-table' );
11 }
12
13 public function getDescription(): string {
14 return __( 'Manage how tiered pricing and discounts appear on the cart page.', 'tier-pricing-table' );
15 }
16
17 public function getSlug(): string {
18 return 'cart';
19 }
20
21 public function getSettings(): array {
22 return array(
23 array(
24 'title' => __( 'Display price as discount', 'tier-pricing-table' ),
25 'id' => Settings::SETTINGS_PREFIX . 'show_discount_in_cart',
26 'desc' => __( 'Show a crossed-out regular price next to the discounted tiered price in the cart. For example: ',
27 'tier-pricing-table' ) . ' <b><del>$10.00</del> <ins>$8.00</ins><b>',
28 'type' => TPTSwitchOption::FIELD_TYPE,
29 'default' => 'yes',
30 ),
31 array(
32 'title' => __( 'Display subtotal as discount', 'tier-pricing-table' ),
33 'id' => Settings::SETTINGS_PREFIX . 'show_subtotal_as_discount_in_cart',
34 'desc' => __( 'Show a crossed-out regular subtotal next to the discounted subtotal in the cart.',
35 'tier-pricing-table' ),
36 'type' => TPTSwitchOption::FIELD_TYPE,
37 'default' => 'yes',
38 ),
39 array(
40 'title' => __( 'Always use regular price', 'tier-pricing-table' ),
41 'id' => Settings::SETTINGS_PREFIX . 'consider_sale_price_as_discount_in_cart',
42 'desc' => __( 'When crossing out a price, always display the regular price rather than a sale price.',
43 'tier-pricing-table' ),
44 'type' => TPTSwitchOption::FIELD_TYPE,
45 'default' => 'no',
46 ),
47 );
48 }
49
50
51 /**
52 * When a cart item has a tiered price, show its subtotal as a discount with the original subtotal crossed out.
53 *
54 * @return bool
55 */
56 public static function showSubtotalInCartAsDiscount(): bool {
57 return get_option( Settings::SETTINGS_PREFIX . 'show_subtotal_as_discount_in_cart', 'yes' ) === 'yes';
58 }
59
60 /**
61 * Do global pricing rules have a higher priority than product level rules?
62 *
63 * @return bool
64 */
65 public static function globalRulesOverrideProductLevelRules(): bool {
66 return get_option( Settings::SETTINGS_PREFIX . 'override_prices_by_global_rules', 'no' ) === 'yes';
67 }
68 }
69