PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.6.5
ShopBuilder – WooCommerce Builder For Elementor v2.6.5
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
shopbuilder / app / Modules / Badges / Badges.php

Badges.php in ShopBuilder – WooCommerce Builder For Elementor 2.6.5, at app/Modules/Badges/Badges.php

76 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Main FilterHooks class.
4 *
5 * @package RadiusTheme\SB
6 */
7
8 namespace RadiusTheme\SB\Modules\Badges;
9
10 use RadiusTheme\SB\Helpers\Fns;
11 use RadiusTheme\SB\Traits\SingletonTrait;
12
13 defined( 'ABSPATH' ) || exit();
14
15 /**
16 * Main FilterHooks class.
17 */
18 class Badges {
19 /**
20 * Singleton Trait.
21 */
22 use SingletonTrait;
23
24 /**
25 * @var array|mixed
26 */
27 private array $options;
28
29 /**
30 * Module Class Constructor.
31 */
32 private function __construct() {
33 $this->options = Fns::get_options( 'modules', 'product_badges' );
34 $this->theme_support();
35 BadgesFrontEnd::instance();
36 }
37
38 /**
39 * @return void
40 */
41 private function theme_support() {
42 // Astra Theme Support.
43 if ( ! defined( 'ASTRA_EXT_VER' ) || ( defined( 'ASTRA_EXT_VER' ) && ! \Astra_Ext_Extension::is_active( 'woocommerce' ) ) ) {
44 add_filter( 'astra_addon_shop_cards_buttons_html', [ $this, 'astra_flash_sale_html_remove' ], 50 );
45 }
46 }
47
48
49 /**
50 * @param $html
51 *
52 * @return string
53 */
54 public function astra_flash_sale_html_remove( $html ) {
55 $hide_default_badge = $this->options['hide_woocommerce_badge'] ?? false;
56
57 if ( ! $hide_default_badge ) {
58 return $html;
59 }
60 global $product;
61 $hide_on_sale = ( $this->options['hide_on_sale'] ?? 'all_products' );
62 switch ( $hide_on_sale ) {
63 case 'where_custom_badge_applied':
64 if ( BadgesFns::is_allowed_badge_showing() ) {
65 $html = '';
66 }
67 break;
68 case 'all_products':
69 $html = '';
70 break;
71 default:
72 }
73 return $html;
74 }
75 }
76