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
tier-pricing-table / src / Addons / GlobalTieredPricing / GlobalTieredPricingAddon.php

GlobalTieredPricingAddon.php in Tiered Pricing Table for WooCommerce 8.0.2, at src/Addons/GlobalTieredPricing/GlobalTieredPricingAddon.php

50 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace TierPricingTable\Addons\GlobalTieredPricing;
2
3 use TierPricingTable\Addons\AbstractAddon;
4 use TierPricingTable\Addons\GlobalTieredPricing\CPT\GlobalTieredPricingCPT;
5
6 class GlobalTieredPricingAddon extends AbstractAddon {
7
8 public function getName(): string {
9 return __( 'Global pricing rules', 'tier-pricing-table' );
10 }
11
12 public function run() {
13
14 // Enable pricing service
15 add_filter( 'tiered_pricing_table/services/pricing_service_enabled', '__return_true' );
16
17 new LookupService();
18 new GlobalTieredPricingCPT();
19 new GlobalTieredPricingCartManager();
20 new PricingService();
21
22 GlobalPricingRulesRepository::getInstance();
23
24 add_action( 'tiered_pricing_table/admin/pricing_tab_end', array(
25 $this,
26 'showMessageOnProductsTieredPricingTab',
27 ), 999 );
28 }
29
30 public function showMessageOnProductsTieredPricingTab() {
31 $globalRules = GlobalTieredPricingCPT::getGlobalRules( false );
32
33 if ( empty( $globalRules ) ) {
34 $this->getContainer()->getFileManager()->includeTemplate( 'addons/global-rules/tiered-pricing-tab.php' );
35 }
36 }
37
38 public function getDescription(): string {
39 return __( 'Create reusable pricing rules and apply them globally.', 'tier-pricing-table' );
40 }
41
42 public function getIcon(): string {
43 return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"/></svg>';
44 }
45
46 public function getSlug(): string {
47 return 'global-tier-pricing';
48 }
49 }
50