PluginProbe
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant / 1.11.0
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant v1.11.0
2.3.2 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 All 60 releases
merchant / inc / compatibility / class-merchant-bricks-builder.php

class-merchant-bricks-builder.php in Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant 1.11.0, at inc/compatibility/class-merchant-bricks-builder.php

73 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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