PluginProbe ʕ •ᴥ•ʔ
Admin Columns / 7.1.4
Admin Columns v7.1.4
7.1.4 7.0.19 2.3.5 2.4 2.4.1 2.4.10 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.6.1 2.5.6.2 2.5.6.3 2.5.6.4 3.0 3.0.1 3.0.2 3.0.3 3.0.5 3.0.7 3.1 3.1.1 3.1.10 3.1.2 3.1.3 3.1.5 3.2.3 3.2.7 3.3.1 3.4.1 3.4.6 3.4.8 4.0.1 4.0.3 4.1.6 4.2.2 4.2.5 4.3 4.3.2 4.4.1 4.4.4 4.4.5 4.5.5 4.6.1 4.7.18 4.7.19 4.7.20 4.7.7 7.0.13 7.0.14 7.0.16 trunk 1.0 1.1 1.1.3 1.2 1.2.1 1.3 1.3.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.5.1 1.4.6 1.4.6.1 1.4.6.2 1.4.6.3 1.4.6.4 1.4.7 1.4.8 1.4.9 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2 2.2.1 2.2.1.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.5.1 2.2.6 2.2.6.1 2.2.6.2 2.2.6.3 2.2.6.4 2.2.7 2.2.8 2.2.8.1 2.2.9 2.3.1 2.3.2 2.3.3
codepress-admin-columns / classes / Admin / Banner / Context / WooCommerce.php
codepress-admin-columns / classes / Admin / Banner / Context Last commit date
Acf.php 4 days ago WooCommerce.php 4 days ago
WooCommerce.php
147 lines
1 <?php
2
3 declare(strict_types=1);
4
5 namespace AC\Admin\Banner\Context;
6
7 use AC;
8 use AC\Admin\Banner\BannerContext;
9 use AC\PostType;
10 use AC\TableScreen;
11 use AC\Type\StartingPrice;
12 use AC\Type\Url\Site;
13 use AC\Type\Url\UtmTags;
14
15 class WooCommerce implements BannerContext
16 {
17 public function is_active(TableScreen $table_screen): bool
18 {
19 if (! AC\WooCommerce::is_active()) {
20 return false;
21 }
22
23 return $this->get_screen_type($table_screen) !== null;
24 }
25
26 public function get_priority(): int
27 {
28 return 5;
29 }
30
31 public function get_arguments(TableScreen $table_screen): array
32 {
33 $upgrade_url = new UtmTags(new Site(Site::PAGE_ADDON_WOOCOMMERCE), 'banner-woocommerce');
34 $is_product = $this->get_screen_type($table_screen) === 'product';
35
36 return [
37 'badge' => __('Admin Columns Pro', 'codepress-admin-columns'),
38 'title' => $is_product
39 ? __('Manage your products faster', 'codepress-admin-columns')
40 : __('Manage your orders faster', 'codepress-admin-columns'),
41 'description' => $is_product
42 ? __('Your product list is more than a list. With Pro, it becomes a workspace where you can view, edit, filter, and export every product detail - without opening a single product.', 'codepress-admin-columns')
43 : __('Stop clicking into orders to find what you need. Pro turns your order list into a filterable, sortable, exportable overview - built for the way you actually manage orders.', 'codepress-admin-columns'),
44 'features_label' => __('With Pro you get', 'codepress-admin-columns'),
45 'features' => $is_product
46 ? $this->get_product_features($upgrade_url)
47 : $this->get_order_features($upgrade_url),
48 'upgrade_cta' => $is_product
49 ? __('Take control of your products', 'codepress-admin-columns')
50 : __('Filter, edit & manage your orders', 'codepress-admin-columns'),
51 'upgrade_cta_price' => sprintf(
52 '%s · %s',
53 sprintf(
54 /* translators: %s: price (e.g. $79) */
55 __('from %s/year', 'codepress-admin-columns'),
56 StartingPrice::get()
57 ),
58 __('all features included', 'codepress-admin-columns')
59 ),
60 'integrations' => [],
61 'promo_url' => $upgrade_url->get_url(),
62 ];
63 }
64
65 private function get_screen_type(TableScreen $table_screen): ?string
66 {
67 if ($table_screen instanceof PostType) {
68 $post_type = (string)$table_screen->get_post_type();
69
70 if ('product' === $post_type) {
71 return 'product';
72 }
73
74 if ('shop_order' === $post_type) {
75 return 'order';
76 }
77 }
78
79 if ('wc_order' === (string)$table_screen->get_id()) {
80 return 'order';
81 }
82
83 return null;
84 }
85
86 private function get_product_features(UtmTags $upgrade_url): array
87 {
88 return [
89 [
90 'url' => $upgrade_url->with_content('usp-wc-product-columns')->get_url(),
91 'label' => __('Add price, stock, SKU, and attributes as columns', 'codepress-admin-columns'),
92 ],
93 [
94 'url' => $upgrade_url->with_content('usp-wc-product-editing')->get_url(),
95 'label' => __('Inline edit product data directly in the table', 'codepress-admin-columns'),
96 ],
97 [
98 'url' => $upgrade_url->with_content('usp-wc-product-bulk')->get_url(),
99 'label' => __('Bulk update prices or stock across hundreds of products', 'codepress-admin-columns'),
100 ],
101 [
102 'url' => $upgrade_url->with_content('usp-wc-product-filtering')->get_url(),
103 'label' => __('Filter products by any field - including custom fields', 'codepress-admin-columns'),
104 ],
105 [
106 'url' => $upgrade_url->with_content('usp-wc-product-export')->get_url(),
107 'label' => __('Export filtered product lists to CSV', 'codepress-admin-columns'),
108 ],
109 [
110 'url' => $upgrade_url->with_content('usp-wc-product-views')->get_url(),
111 'label' => __('Save different column layouts for different tasks', 'codepress-admin-columns'),
112 ],
113 ];
114 }
115
116 private function get_order_features(UtmTags $upgrade_url): array
117 {
118 return [
119 [
120 'url' => $upgrade_url->with_content('usp-wc-order-columns')->get_url(),
121 'label' => __('Add shipping method, coupons, and item count as columns', 'codepress-admin-columns'),
122 ],
123 [
124 'url' => $upgrade_url->with_content('usp-wc-order-filtering')->get_url(),
125 'label' => __('Filter orders by product, status, date range, or custom field', 'codepress-admin-columns'),
126 ],
127 [
128 'url' => $upgrade_url->with_content('usp-wc-order-sorting')->get_url(),
129 'label' => __('Sort by total, item count, or any order detail', 'codepress-admin-columns'),
130 ],
131 [
132 'url' => $upgrade_url->with_content('usp-wc-order-editing')->get_url(),
133 'label' => __('Inline edit order status and custom fields', 'codepress-admin-columns'),
134 ],
135 [
136 'url' => $upgrade_url->with_content('usp-wc-order-export')->get_url(),
137 'label' => __('Export filtered order sets to CSV in one click', 'codepress-admin-columns'),
138 ],
139 [
140 'url' => $upgrade_url->with_content('usp-wc-order-views')->get_url(),
141 'label' => __('Save views for different workflows - refunds, fulfilment, reporting', 'codepress-admin-columns'),
142 ],
143 ];
144 }
145
146 }
147