PluginProbe
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant / 1.8
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant v1.8
2.3.1 2.3.0 2.2.8 2.2.7 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.11.0 1.11.1 1.11.2 1.6 1.7 1.8 1.8.1 1.8.2 1.8.3 1.9.0 1.9.1 1.9.10 1.9.11 1.9.12 All 59 releases
merchant / admin / classes / class-merchant-admin-modules.php

class-merchant-admin-modules.php in Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant 1.8, at admin/classes/class-merchant-admin-modules.php

483 lines 21.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Merchant_Admin_Modules Class.
4 */
5
6 if ( ! defined( 'ABSPATH' ) ) {
7 exit; // Exit if accessed directly
8 }
9
10 if ( ! class_exists( 'Merchant_Admin_Modules' ) ) {
11
12 class Merchant_Admin_Modules {
13
14 /**
15 * Upsell modules.
16 *
17 */
18 public static $modules_data = array();
19
20 /**
21 * The single class instance.
22 */
23 private static $instance = null;
24
25 /**
26 * Instance.
27 */
28 public static function instance() {
29 if ( is_null( self::$instance ) ) {
30 self::$instance = new self();
31 }
32 return self::$instance;
33 }
34
35 /**
36 * Constructor.
37 */
38 public function __construct() {
39 self::$modules_data = array(
40
41 // Convert More.
42 'buy-now' => array(
43 'pro' => false,
44 'section' => 'convert-more',
45 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-buy-now' ),
46 'title' => esc_html__( 'Buy Now', 'merchant' ),
47 'desc' => esc_html__( 'Send your customers directly to checkout instead of the cart with Buy Now buttons', 'merchant' ),
48 'tutorial_url' => 'https://docs.athemes.com/article/buy-now/'
49 ),
50 'product-labels' => array(
51 'pro' => false,
52 'section' => 'convert-more',
53 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-product-labels' ),
54 'title' => esc_html__( 'Product Labels', 'merchant' ),
55 'desc' => esc_html__( 'Create customizable product labels with specific display conditions and color settings', 'merchant' ),
56 'tutorial_url' => 'https://docs.athemes.com/article/product-labels/'
57 ),
58 'animated-add-to-cart' => array(
59 'pro' => false,
60 'section' => 'convert-more',
61 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-animated-add-to-cart' ),
62 'title' => esc_html__( 'Animated Add to Cart', 'merchant' ),
63 'desc' => esc_html__( 'Make your Add To Cart button stand out by adding an animation on mouse over or page load', 'merchant' ),
64 'tutorial_url' => 'https://docs.athemes.com/article/animated-add-to-cart/'
65 ),
66 'quick-view' => array(
67 'pro' => false,
68 'section' => 'convert-more',
69 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-quick-view' ),
70 'title' => esc_html__( 'Quick View', 'merchant' ),
71 'desc' => esc_html__( 'Allows users to quickly view product details without leaving the current page', 'merchant' ),
72 'tutorial_url' => 'https://docs.athemes.com/article/quick-view/'
73 ),
74 'add-to-cart-text' => array(
75 'pro' => false,
76 'section' => 'convert-more',
77 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-add-to-cart-text' ),
78 'title' => esc_html__( 'Add To Cart Text', 'merchant' ),
79 'desc' => esc_html__( 'Change your store\'s \'Add to Cart\' text for various product types, as well as individual products', 'merchant' ),
80 'tutorial_url' => 'https://docs.athemes.com/article/merchant-add-to-cart-text/'
81 ),
82 'sticky-add-to-cart' => array(
83 'pro' => true,
84 'section' => 'convert-more',
85 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-sticky-add-to-cart' ),
86 'title' => esc_html__( 'Sticky Add To Cart', 'merchant' ),
87 'desc' => esc_html__( 'Display a sticky add to cart bar when visitors are scrolling on your product pages', 'merchant' ),
88 'tutorial_url' => 'https://docs.athemes.com/article/merchant-sticky-add-to-cart/'
89 ),
90 'countdown-timer' => array(
91 'pro' => true,
92 'section' => 'convert-more',
93 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-countdown-timer' ),
94 'title' => esc_html__( 'Countdown Timer', 'merchant' ),
95 'desc' => esc_html__( 'Create a sense of urgency by displaying a countdown timer on your discounted products', 'merchant' ),
96 'tutorial_url' => 'https://docs.athemes.com/article/merchant-countdown-timer/'
97 ),
98 'stock-scarcity' => array(
99 'pro' => true,
100 'section' => 'convert-more',
101 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-stock-scarcity' ),
102 'title' => esc_html__( 'Stock Scarcity', 'merchant' ),
103 'desc' => esc_html__( 'Let visitors know that stock is running low on products they are looking at', 'merchant' ),
104 'tutorial_url' => 'https://docs.athemes.com/article/merchant-stock-scarcity/'
105 ),
106 'wait-list' => array(
107 'pro' => true,
108 'section' => 'convert-more',
109 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-wait-list' ),
110 'title' => esc_html__( 'Waitlist', 'merchant' ),
111 'desc' => esc_html__( 'Build a waiting list for sold-out items and auto-notify potential customers when stock’s back', 'merchant' ),
112 'tutorial_url' => 'https://docs.athemes.com/article/merchant-waitlist/'
113 ),
114 'checkout' => array(
115 'pro' => true,
116 'section' => 'convert-more',
117 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-checkout' ),
118 'title' => esc_html__( 'Checkouts', 'merchant' ),
119 'desc' => esc_html__( 'Choose from three different checkout layouts: Shopify-style, Multi-step or One-page', 'merchant' ),
120 'tutorial_url' => 'https://docs.athemes.com/article/merchant-checkouts/'
121 ),
122 'recently-viewed-products' => array(
123 'pro' => true,
124 'section' => 'convert-more',
125 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-recently-viewed-products' ),
126 'title' => esc_html__( 'Recently Viewed Products', 'merchant' ),
127 'desc' => esc_html__( 'Show recently viewed products on product pages and in the cart', 'merchant' ),
128 'tutorial_url' => 'https://docs.athemes.com/article/merchant-recently-viewed-products/'
129 ),
130 'advanced-reviews' => array(
131 'pro' => true,
132 'section' => 'convert-more',
133 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-advanced-reviews' ),
134 'title' => esc_html__( 'Advanced Reviews', 'merchant' ),
135 'desc' => esc_html__( 'Let customers run your marketing by collecting and displaying advanced reviews', 'merchant' ),
136 'tutorial_url' => 'https://docs.athemes.com/article/merchant-advanced-reviews/'
137 ),
138
139 // Boost Revenue.
140 'frequently-bought-together' => array(
141 'pro' => true,
142 'section' => 'boost-revenue',
143 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-frequently-bought-together' ),
144 'title' => esc_html__( 'Frequently Bought Together', 'merchant' ),
145 'desc' => esc_html__( 'Create bundles of related products and offer them at a discount or at the regular price', 'merchant' ),
146 'tutorial_url' => 'https://docs.athemes.com/article/merchant-frequently-bought-together/'
147 ),
148 'buy-x-get-y' => array(
149 'pro' => true,
150 'section' => 'boost-revenue',
151 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-buy-x-get-y' ),
152 'title' => esc_html__( 'Buy X, Get Y', 'merchant' ),
153 'desc' => esc_html__( 'When product X is purchased, give a discount on product Y ', 'merchant' ),
154 'tutorial_url' => 'https://docs.athemes.com/article/merchant-buy-x-get-y/'
155 ),
156 'volume-discounts' => array(
157 'pro' => true,
158 'section' => 'boost-revenue',
159 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-volume-discounts' ),
160 'title' => esc_html__( 'Bulk Discounts', 'merchant' ),
161 'desc' => esc_html__( 'Offer discounts on larger quantity purchases to drive up average order value', 'merchant' ),
162 'tutorial_url' => 'https://docs.athemes.com/article/merchant-bulk-discounts/'
163 ),
164 'spending-goal' => array(
165 'pro' => true,
166 'section' => 'boost-revenue',
167 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-spending-goal' ),
168 'title' => esc_html__( 'Spending Discount Goal', 'merchant' ),
169 'desc' => esc_html__( 'Motivate higher order values by offering customers discounts for reaching spending goals', 'merchant' ),
170 'tutorial_url' => 'https://docs.athemes.com/article/merchant-spending-goal/'
171 ),
172 'free-gifts' => array(
173 'pro' => true,
174 'section' => 'boost-revenue',
175 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-free-gifts' ),
176 'title' => esc_html__( 'Free Gifts', 'merchant' ),
177 'desc' => esc_html__( 'Reward shoppers with a gift if they hit a specified spending target or apply a coupon', 'merchant' ),
178 'tutorial_url' => 'https://docs.athemes.com/article/merchant-gift-card/'
179 ),
180 'pre-orders' => array(
181 'pro' => false,
182 'section' => 'boost-revenue',
183 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-pre-orders' ),
184 'title' => esc_html__( 'Pre-Orders', 'merchant' ),
185 'desc' => esc_html__( 'Allow visitors to pre-order products that are either out of stock or not yet released', 'merchant' ),
186 'tutorial_url' => 'https://docs.athemes.com/article/pre-orders/'
187 ),
188
189 // Reduce Abandonment.
190 'floating-mini-cart' => array(
191 'pro' => true,
192 'section' => 'reduce-abandonment',
193 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-floating-mini-cart' ),
194 'title' => esc_html__( 'Floating Mini Cart', 'merchant' ),
195 'desc' => esc_html__( 'A cart icon will always be visible and a sliding cart when the customer clicks it', 'merchant' ),
196 'tutorial_url' => 'https://docs.athemes.com/article/merchant-side-cart/'
197 ),
198 'cart-reserved-timer' => array(
199 'pro' => true,
200 'section' => 'reduce-abandonment',
201 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-cart-reserved-timer' ),
202 'title' => esc_html__( 'Cart Reserved Timer', 'merchant' ),
203 'desc' => esc_html__( 'Create urgency by letting visitors know that the products in cart are reserved for a limited time', 'merchant' ),
204 'tutorial_url' => 'https://docs.athemes.com/article/merchant-cart-reserved-timer/'
205 ),
206 'side-cart' => array(
207 'pro' => true,
208 'section' => 'reduce-abandonment',
209 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-side-cart' ),
210 'title' => esc_html__( 'Side Cart', 'merchant' ),
211 'desc' => esc_html__( 'Show a sliding cart whenever a customer adds a product to the cart', 'merchant' ),
212 'tutorial_url' => 'https://docs.athemes.com/article/merchant-side-cart/'
213 ),
214 'cart-count-favicon' => array(
215 'pro' => false,
216 'section' => 'reduce-abandonment',
217 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-cart-count-favicon' ),
218 'title' => esc_html__( 'Cart Count Favicon', 'merchant' ),
219 'desc' => esc_html__( 'Make your browser tab stand out by showing the number of items in the cart on the favicon', 'merchant' ),
220 'tutorial_url' => 'https://docs.athemes.com/article/cart-count-favicon/'
221 ),
222 'inactive-tab-message' => array(
223 'pro' => false,
224 'section' => 'reduce-abandonment',
225 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-inactive-tab-message' ),
226 'title' => esc_html__( 'Inactive Tab Message', 'merchant' ),
227 'desc' => esc_html__( 'Modify the browser tab\'s title when the visitor navigates away from your store', 'merchant' ),
228 'tutorial_url' => 'https://docs.athemes.com/article/merchant-inactive-tab-message/'
229 ),
230
231 // Build Trust.
232 'reasons-to-buy' => array(
233 'pro' => true,
234 'section' => 'build-trust',
235 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-reasons-to-buy' ),
236 'title' => esc_html__( 'Reasons To Buy List', 'merchant' ),
237 'desc' => esc_html__( 'Provide customers with a summary of the key features and benefits of your products', 'merchant' ),
238 'tutorial_url' => 'https://docs.athemes.com/article/merchant-reasons-to-buy/'
239 ),
240 'product-brand-image' => array(
241 'pro' => true,
242 'section' => 'build-trust',
243 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-product-brand-image' ),
244 'title' => esc_html__( 'Product Brand Image', 'merchant' ),
245 'desc' => esc_html__( 'Add brand images to products to instill confidence in potential buyers', 'merchant' ),
246 'tutorial_url' => 'https://docs.athemes.com/article/merchant-product-brand-image/'
247 ),
248 'quick-social-links' => array(
249 'pro' => true,
250 'section' => 'build-trust',
251 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-quick-social-links' ),
252 'title' => esc_html__( 'Quick Social Links', 'merchant' ),
253 'desc' => esc_html__( 'Display floating social media icons to make it easier for your customers to connect with you', 'merchant' ),
254 'tutorial_url' => 'https://docs.athemes.com/article/merchant-quick-social-links/'
255 ),
256 'trust-badges' => array(
257 'pro' => false,
258 'section' => 'build-trust',
259 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-trust-badges' ),
260 'title' => esc_html__( 'Trust Badges', 'merchant' ),
261 'desc' => esc_html__( 'Reassure customers by showcasing different badge-shaped store benefits', 'merchant' ),
262 'tutorial_url' => 'https://docs.athemes.com/article/trust-badges/'
263 ),
264 'payment-logos' => array(
265 'pro' => false,
266 'section' => 'build-trust',
267 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-payment-logos' ),
268 'title' => esc_html__( 'Payment Logos', 'merchant' ),
269 'desc' => esc_html__( 'Display the logos of the payment methods you accept on product pages', 'merchant' ),
270 'tutorial_url' => 'https://docs.athemes.com/article/payment-logos/'
271 ),
272
273 // Improve Experience.
274 'size-chart' => array(
275 'pro' => true,
276 'section' => 'improve-experience',
277 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-size-chart' ),
278 'title' => esc_html__( 'Size Chart', 'merchant' ),
279 'desc' => esc_html__( 'Reduce returns and increase sales by showing a size chart on specific products or all products', 'merchant' ),
280 'tutorial_url' => 'https://docs.athemes.com/article/merchant-size-chart/'
281 ),
282 'product-video' => array(
283 'pro' => true,
284 'section' => 'improve-experience',
285 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-product-video' ),
286 'title' => esc_html__( 'Product Video', 'merchant' ),
287 'desc' => esc_html__( 'Upload video to be viewed in product galleries and on archive pages', 'merchant' ),
288 'tutorial_url' => 'https://docs.athemes.com/article/merchant-product-video/'
289 ),
290 'product-audio' => array(
291 'pro' => true,
292 'section' => 'improve-experience',
293 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-product-audio' ),
294 'title' => esc_html__( 'Product Audio', 'merchant' ),
295 'desc' => esc_html__( 'Upload audio to be listened to in product galleries and on archive pages', 'merchant' ),
296 'tutorial_url' => 'https://docs.athemes.com/article/merchant-product-audio/'
297 ),
298 'wishlist' => array(
299 'pro' => true,
300 'section' => 'improve-experience',
301 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-wishlist' ),
302 'title' => esc_html__( 'Wishlist', 'merchant' ),
303 'desc' => esc_html__( 'Allow customers to easily save products they are interested in for later', 'merchant' ),
304 'tutorial_url' => 'https://docs.athemes.com/article/merchant-wishlist/'
305 ),
306 'product-swatches' => array(
307 'pro' => true,
308 'section' => 'improve-experience',
309 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-product-swatches' ),
310 'title' => esc_html__( 'Variation Swatches', 'merchant' ),
311 'desc' => esc_html__( 'Display variable product options as customizable color/image icons, buttons, or dropdowns', 'merchant' ),
312 'tutorial_url' => 'https://docs.athemes.com/article/merchant-variation-swatches/'
313 ),
314 'login-popup' => array(
315 'pro' => true,
316 'section' => 'improve-experience',
317 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-login-popup' ),
318 'title' => esc_html__( 'Login Popup', 'merchant' ),
319 'desc' => esc_html__( 'Allow users to log in with a simple pop up without navigating to a new page', 'merchant' ),
320 'tutorial_url' => 'https://docs.athemes.com/article/merchant-login-popup/'
321 ),
322 'product-navigation-links' => array(
323 'pro' => true,
324 'section' => 'improve-experience',
325 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-product-navigation-links' ),
326 'title' => esc_html__( 'Product Navigation Links', 'merchant' ),
327 'desc' => esc_html__( 'Enable easy navigation from one product to the next with next/previous links', 'merchant' ),
328 'tutorial_url' => 'https://docs.athemes.com/article/merchant-product-navigation-links/'
329 ),
330 'real-time-search' => array(
331 'pro' => false,
332 'section' => 'improve-experience',
333 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-real-time-search' ),
334 'title' => esc_html__( 'Real-Time Search', 'merchant' ),
335 'desc' => esc_html__( 'Help visitors instantly find the products they\'re looking for by using predictive search', 'merchant' ),
336 'tutorial_url' => 'https://docs.athemes.com/article/real-time-search/'
337 ),
338 'auto-external-links' => array(
339 'pro' => false,
340 'section' => 'improve-experience',
341 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-auto-external-links' ),
342 'title' => esc_html__( 'Auto External Links', 'merchant' ),
343 'desc' => esc_html__( 'Keep users from navigating away from your store by opening external links in a new browser tab', 'merchant' ),
344 'tutorial_url' => 'https://docs.athemes.com/article/auto-external-links/'
345 ),
346 'scroll-to-top-button' => array(
347 'pro' => false,
348 'section' => 'improve-experience',
349 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-scroll-to-top-button' ),
350 'title' => esc_html__( 'Scroll to Top Button', 'merchant' ),
351 'desc' => esc_html__( 'Help your customers get back easily to the top of the page with a single click', 'merchant' ),
352 'tutorial_url' => 'https://docs.athemes.com/article/scroll-to-top-button/'
353 ),
354 'code-snippets' => array(
355 'pro' => false,
356 'section' => 'improve-experience',
357 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-code-snippets' ),
358 'title' => esc_html__( 'Code Snippets', 'merchant' ),
359 'desc' => esc_html__( 'Add code snippets in WordPress without having to edit your theme\'s functions.php file ', 'merchant' ),
360 'tutorial_url' => 'https://docs.athemes.com/article/code-snippets/'
361 ),
362
363 // Protect Store.
364 'agree-to-terms-checkbox' => array(
365 'pro' => false,
366 'section' => 'protect-your-store',
367 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-agree-to-terms-checkbox' ),
368 'title' => esc_html__( 'Agree to Terms Checkbox', 'merchant' ),
369 'desc' => esc_html__( 'Get customers to agree to your Terms & Conditions as part of the checkout process', 'merchant' ),
370 'tutorial_url' => 'https://docs.athemes.com/article/agree-to-terms-checkbox/'
371 ),
372 'cookie-banner' => array(
373 'pro' => false,
374 'section' => 'protect-your-store',
375 'icon' => Merchant_SVG_Icons::get_svg_icon( 'module-cookie-banner' ),
376 'title' => esc_html__( 'Cookie Banner', 'merchant' ),
377 'desc' => esc_html__( 'Inform your visitors that the site uses cookies via a dismissable banner', 'merchant' ),
378 'tutorial_url' => 'https://docs.athemes.com/article/cookie-banner/'
379 )
380
381 );
382
383 }
384
385 /**
386 * Get modules.
387 */
388 public static function get_modules() {
389
390 $modules = array(
391
392 'boost-revenue' => array(
393 'title' => esc_html__( 'Boost Revenue', 'merchant' ),
394 'modules' => array(),
395 ),
396
397 'convert-more' => array(
398 'title' => esc_html__( 'Convert More', 'merchant' ),
399 'modules' => array()
400 ),
401
402 'reduce-abandonment' => array(
403 'title' => esc_html__( 'Reduce Cart Abandonment', 'merchant' ),
404 'modules' => array(),
405 ),
406
407 'build-trust' => array(
408 'title' => esc_html__( 'Build Trust', 'merchant' ),
409 'modules' => array(),
410 ),
411
412 'improve-experience' => array(
413 'title' => esc_html__( 'Improve Experience', 'merchant' ),
414 'modules' => array(),
415 ),
416
417 'protect-your-store' => array(
418 'title' => esc_html__( 'Protect Store', 'merchant' ),
419 'modules' => array()
420 ),
421
422 );
423
424 /**
425 * Hook: merchant_modules
426 *
427 * @since 1.0
428 */
429 $modules = apply_filters( 'merchant_modules', $modules );
430
431 return $modules;
432
433 }
434
435 /**
436 * Get upsell modules.
437 *
438 */
439 public static function get_upsell_modules() {
440 return array_filter( self::$modules_data, function( $module ){
441 return isset( $module[ 'pro' ] ) && $module[ 'pro' ] ? $module : false;
442 } );
443 }
444
445 /**
446 * Add upsell to modules.
447 *
448 */
449 public static function add_upsell_modules( $modules ) {
450 if ( defined( 'MERCHANT_PRO_VERSION' ) ) {
451 return $modules;
452 }
453
454 foreach ( self::get_upsell_modules() as $module_id => $module_data ) {
455 $modules[ $module_data[ 'section' ] ][ 'modules' ][ $module_id ] = $module_data;
456 }
457
458 return $modules;
459 }
460
461 /**
462 * Get module info.
463 */
464 public static function get_module_info( $module ) {
465
466 $modules = self::get_modules();
467
468 $maybe_found = array_column( array_column( $modules, 'modules' ), $module );
469
470 if ( ! empty( $maybe_found ) && ! empty( $maybe_found[0] ) ) {
471 return $maybe_found[0];
472 }
473
474 return false;
475
476 }
477
478 }
479
480 Merchant_Admin_Modules::instance();
481
482 }
483