PluginProbe
Tiered Pricing Table for WooCommerce / trunk
Tiered Pricing Table for WooCommerce vtrunk
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 2.3.4 All 90 releases
tier-pricing-table / src / Integrations / Plugins / U2CodeProductAddons.php

U2CodeProductAddons.php in Tiered Pricing Table for WooCommerce trunk, at src/Integrations/Plugins/U2CodeProductAddons.php

98 lines 3.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace TierPricingTable\Integrations\Plugins;
2
3 /**
4 * U2Code Product Addons — product options / extra fields with per-option pricing.
5 *
6 * The price handling lives on the Simple Product Addons side (its own Tiered Pricing Table
7 * integration folds addon prices into the tier price via `tiered_pricing_table/cart/product_cart_price`
8 * and bases percentage options on the tier price actually charged). This class registers the pairing
9 * on the Tiered Pricing side: the integrations screen entry, and a bridge so that switching the
10 * integration off here also stops the addons-side integration — one toggle governs the pairing.
11 */
12 class U2CodeProductAddons extends PluginIntegrationAbstract {
13
14
15 public function __construct() {
16 parent::__construct();
17
18 // One toggle governs the whole pairing: when the integration is switched off on the
19 // Tiered Pricing side, unregister the addons-side integration as well. The plugin ships
20 // in two distributions with different namespaces (SimpleProductAddons — free build,
21 // U2Code\ProductAddons — premium); instanceof against a class from an inactive plugin
22 // is safe, it simply never matches.
23 if ( ! $this->isEnabled() ) {
24 add_filter( 'simple_product_addons/integrations', function ( $integrations ) {
25 return array_filter( (array) $integrations, function ( $integration ) {
26 return ! ( $integration instanceof \SimpleProductAddons\Integrations\Plugins\TieredPricingTable )
27 && ! ( $integration instanceof \U2Code\ProductAddons\Integrations\Plugins\TieredPricingTable );
28 } );
29 } );
30 }
31 }
32
33 public function getTitle(): string {
34 return 'U2Code Product Addons';
35 }
36
37 public function getDescription(): string {
38 return __( 'Custom product options with per-option pricing, live totals and conditional logic. Deep integration: addon prices follow the tier price.',
39 'tier-pricing-table' );
40 }
41
42 public function getSlug(): string {
43 return 'u2code-product-addons';
44 }
45
46 public function isOfficial(): bool {
47 return true;
48 }
49
50 public function getAuthorURL(): string {
51 return 'https://product-addons.com/?utm_source=tiered-pricing-table&utm_medium=plugin&utm_campaign=integrations-page';
52 }
53
54 public function getIconURL(): string {
55 return $this->getContainer()->getFileManager()->locateAsset( 'admin/integrations/u2code-product-addons-icon.svg' );
56 }
57
58 public function getMetaPills(): array {
59 return array(
60 __( '11+ field types', 'tier-pricing-table' ),
61 __( 'Per-option pricing', 'tier-pricing-table' ),
62 __( 'Conditional logic', 'tier-pricing-table' ),
63 __( 'Live totals', 'tier-pricing-table' ),
64 );
65 }
66
67 public function getActionLinks(): array {
68 return array(
69 array(
70 'url' => 'https://wordpress.org/plugins/u2code-product-addons-for-woocommerce/',
71 'label' => __( 'Free on WordPress.org', 'tier-pricing-table' ),
72 'target' => '_blank',
73 ),
74 array(
75 'url' => 'https://product-addons.com/?utm_source=tiered-pricing-table&utm_medium=plugin&utm_campaign=integrations-page',
76 'label' => __( 'Learn more', 'tier-pricing-table' ),
77 'target' => '_blank',
78 ),
79 );
80 }
81
82 public function run() {
83 /**
84 * The pairing is registered. Price handling lives on the Simple Product Addons side —
85 * future Tiered Pricing–side glue for this integration belongs here.
86 *
87 * @param U2CodeProductAddons $this
88 */
89 do_action( 'tiered_pricing_table/integration/simple_product_addons/run', $this );
90 }
91
92 public function getIntegrationCategory(): string {
93 return 'product_addons';
94 }
95
96
97 }
98