inc/compatibility
class-merchant-astra-theme.php
1.1 KB
1 month ago
class-merchant-avada-theme.php
918 B
1 month ago
class-merchant-blocksy-theme.php
4.8 KB
1 month ago
class-merchant-botiga-theme.php
4.4 KB
1 month ago
class-merchant-breakdance-builder.php
12.8 KB
1 month ago
class-merchant-bricks-builder.php
1.5 KB
1 month ago
class-merchant-divi-theme.php
5.9 KB
1 month ago
class-merchant-elementor-builder.php
7.3 KB
1 month ago
class-merchant-flatsome-theme.php
948 B
1 month ago
class-merchant-kadence-theme.php
938 B
1 month ago
class-merchant-oceanwp-theme.php
1.5 KB
1 month ago
class-merchant-ohio-theme.php
26.1 KB
1 month ago
class-merchant-twenty-twenty-four-theme.php
1.1 KB
1 month ago
class-merchant-woo-multi-currency.php
4.7 KB
1 month ago
class-merchant-woo-payments-plugin.php
1.6 KB
1 month ago
class-merchant-bricks-builder.php in Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant 2.3.1, at inc/compatibility/class-merchant-bricks-builder.php
| 1 | <?php |
| 2 | |
| 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | exit; // Exit if accessed directly |
| 5 | } |
| 6 | |
| 7 | /** |
| 8 | * Bricks Builder compatibility layer |
| 9 | */ |
| 10 | if ( ! class_exists( 'Merchant_Bricks_Builder' ) ) { |
| 11 | class Merchant_Bricks_Builder { |
| 12 | |
| 13 | /** |
| 14 | * Constructor. |
| 15 | */ |
| 16 | public function __construct() { |
| 17 | |
| 18 | if ( ( is_admin() && ! wp_doing_ajax() ) || ! merchant_is_bricks_builder_active() ) { |
| 19 | return; |
| 20 | } |
| 21 | |
| 22 | add_filter( 'merchant_enqueue_module_scripts', array( $this, 'should_enqueue_scripts' ), 10, 2 ); |
| 23 | |
| 24 | // Custom CSS. |
| 25 | add_filter( 'merchant_custom_css', array( $this, 'frontend_custom_css' ) ); |
| 26 | } |
| 27 | |
| 28 | /** |
| 29 | * Determines whether to enqueue scripts for modules. |
| 30 | * |
| 31 | * @param $enqueue |
| 32 | * @param $module |
| 33 | * |
| 34 | * @return mixed|true |
| 35 | */ |
| 36 | public function should_enqueue_scripts( $enqueue, $module ) { |
| 37 | $module_id = $module->module_id ?? ''; |
| 38 | |
| 39 | if ( $module_id === 'product-swatches' ) { |
| 40 | return true; |
| 41 | } |
| 42 | |
| 43 | return $enqueue; |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Frontend custom CSS. |
| 48 | * |
| 49 | * @param string $css The custom CSS. |
| 50 | * @return string $css The custom CSS. |
| 51 | */ |
| 52 | public function frontend_custom_css( $css ) { |
| 53 | |
| 54 | // Wishlist |
| 55 | if ( Merchant_Modules::is_module_active( Merchant_Wishlist::MODULE_ID ) && Merchant_Admin_Options::get( 'wishlist', 'display_on_cart_page', false ) ) { |
| 56 | $css .= ' |
| 57 | .merchant-wishlist-items-cart ul.products li.product { |
| 58 | display: flex; |
| 59 | flex-direction: column; |
| 60 | gap: 10px; |
| 61 | } |
| 62 | '; |
| 63 | } |
| 64 | |
| 65 | return $css; |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | add_action( 'init', function() { |
| 70 | new Merchant_Bricks_Builder(); |
| 71 | } ); |
| 72 | } |
| 73 |