| 1 |
<?php |
| 2 |
|
| 3 |
namespace TierPricingTable\Addons\UserBasedPricing; |
| 4 |
|
| 5 |
use TierPricingTable\Addons\AbstractAddon; |
| 6 |
class UserBasedPricingAddon extends AbstractAddon { |
| 7 |
const SETTING_ENABLE_KEY = 'enable_user_based_pricing_addon'; |
| 8 |
|
| 9 |
public function getName() : string { |
| 10 |
return __( 'User-based pricing rules on individual products', 'tier-pricing-table' ); |
| 11 |
} |
| 12 |
|
| 13 |
public function isActive() : bool { |
| 14 |
return $this->getContainer()->getSettings()->get( self::SETTING_ENABLE_KEY, 'yes' ) === 'yes'; |
| 15 |
} |
| 16 |
|
| 17 |
public function getDescription() : string { |
| 18 |
return __( 'Enable customer-based pricing rules on individual products.', 'tier-pricing-table' ); |
| 19 |
} |
| 20 |
|
| 21 |
public function getIcon() : string { |
| 22 |
return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg>'; |
| 23 |
} |
| 24 |
|
| 25 |
public function getSlug() : string { |
| 26 |
return 'user-based-rules'; |
| 27 |
} |
| 28 |
|
| 29 |
public function run() { |
| 30 |
// Enable pricing service |
| 31 |
add_filter( 'tiered_pricing_table/services/pricing_service_enabled', '__return_true' ); |
| 32 |
new ProductManager(); |
| 33 |
} |
| 34 |
|
| 35 |
} |
| 36 |
|