PluginProbe
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant / 2.3.1
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant v2.3.1
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-breakdance-builder.php
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-breakdance-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-breakdance-builder.php

349 lines 12.8 KB Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 /**
8 * Breakdance Builder compatibility layer
9 */
10 if ( ! class_exists( 'Merchant_Breakdance_Builder' ) ) {
11 class Merchant_Breakdance_Builder {
12
13 /**
14 * Constructor.
15 */
16 public function __construct() {
17 if ( ( is_admin() && ! wp_doing_ajax() ) || ! merchant_is_breakdance_active() ) {
18 return;
19 }
20
21 // Quick View
22 if ( Merchant_Modules::is_module_active( Merchant_Quick_View::MODULE_ID ) ) {
23 $button_position = Merchant_Admin_Options::get( Merchant_Quick_View::MODULE_ID, 'button_position', 'overlay' );
24
25 if ( 'overlay' === $button_position ) {
26 $merchant_quick_view = Merchant_Quick_View::get_instance();
27 add_filter( 'breakdance_before_shop_loop_after_image', array( $merchant_quick_view, 'quick_view_button' ) );
28 remove_action( 'woocommerce_after_shop_loop_item', array( $merchant_quick_view, 'quick_view_button' ) );
29 }
30 }
31
32 if ( merchant_is_pro_active() ) {
33 // Variation Swatches
34 if ( Merchant_Modules::is_module_active( Merchant_Product_Swatches::MODULE_ID ) ) {
35 remove_action( 'breakdance_shop_loop_footer', 'woocommerce_template_loop_add_to_cart' );
36 }
37
38 // Wishlist
39 if ( Merchant_Modules::is_module_active( Merchant_Wishlist::MODULE_ID ) ) {
40 // Display on single product.
41 $display_on_single_product = Merchant_Admin_Options::get( Merchant_Wishlist::MODULE_ID, 'display_on_single_product', true );
42 if ( $display_on_single_product ) {
43 $wishlist = new Merchant_Pro_Wishlist( Merchant_Modules::get_module( Merchant_Wishlist::MODULE_ID ) );;
44
45 add_action( 'woocommerce_after_add_to_cart_form', array( $wishlist, 'wishlist_link' ) );
46 }
47 }
48
49 // Side Cart
50 if ( Merchant_Modules::is_module_active( Merchant_Side_Cart::MODULE_ID ) ) {
51 remove_action( 'woocommerce_widget_cart_item_quantity', '\Breakdance\WooCommerce\addQuantityInputToMiniCart' );
52 }
53
54 // Product Audio
55 if ( Merchant_Modules::is_module_active( Merchant_Product_Audio::MODULE_ID ) || Merchant_Modules::is_module_active( Merchant_Product_Video::MODULE_ID ) ) {
56 add_action('woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail');
57
58 remove_action('woocommerce_before_shop_loop_item_title', '\Breakdance\WooCommerce\wrapThumbnailInADiv' );
59 }
60 }
61
62 // Custom CSS.
63 add_filter( 'merchant_custom_css', array( $this, 'frontend_custom_css' ) );
64 }
65
66 /**
67 * Frontend custom CSS.
68 *
69 * @param string $css The custom CSS.
70 * @return string $css The custom CSS.
71 */
72 public function frontend_custom_css( $css ) {
73 $css .= Merchant_Side_Cart::get_module_custom_css();
74
75 // Quick View
76 if ( Merchant_Modules::is_module_active( Merchant_Quick_View::MODULE_ID ) ) {
77 $css .= '
78 .breakdance-woocommerce .products .product .merchant-quick-view-button {
79 padding: var(--bde-button-padding-base);
80 font-size: var(--bde-button-font-size);
81 line-height: var(--bde-button-line-height);
82 font-weight: var(--bde-button-font-weight);
83 border-radius: var(--bde-button-border-radius);
84 }
85 .breakdance-woocommerce .products .product .merchant-quick-view-position-before {
86 margin-bottom: 10px;
87 }
88 .breakdance-woocommerce .products .product .merchant-quick-view-position-after {
89 margin-top: 10px;
90 }
91 .breakdance-woocommerce .products .product .merchant-quick-view-position-overlay {
92 width: auto;
93 position: absolute;
94 }
95 .merchant-quick-view-modal .bde-quantity-button {
96 display: none !important;
97 }
98 .merchant-quick-view-modal .single_add_to_cart_button,
99 .merchant-quick-view-modal .merchant-bogo-add-to-cart,
100 .merchant-quick-view-modal .merchant-add-bundle-to-cart {
101 padding: var(--bde-button-padding-base);
102 font-size: var(--bde-button-font-size);
103 line-height: var(--bde-button-line-height);
104 font-weight: var(--bde-button-font-weight);
105 border-radius: var(--bde-button-border-radius);
106 }
107 .merchant-quick-view-modal input[type=number] {
108 width: 80px;
109 text-align: center;
110 padding: 10px;
111 }
112 .merchant-quick-view-modal .variations td.value,
113 .merchant-quick-view-modal .variations th.label {
114 display: block;
115 text-align: left;
116 margin: 7px 0;
117 }
118 .merchant-quick-view-modal .merchant-frequently-bought-together-bundle-product img {
119 max-width: none;
120 }
121 ';
122 }
123
124 if ( merchant_is_pro_active() ) {
125 // Variation Swatches
126 if ( Merchant_Modules::is_module_active( Merchant_Product_Swatches::MODULE_ID ) ) {
127 $css .= '
128 .breakdance-woocommerce .products .product a.merchant-variation-item {
129 width: auto;
130 }
131 .breakdance-woocommerce .products .product table.variations {
132 margin-bottom: 10px;
133 }
134 ';
135 }
136
137 // Wishlist
138 if ( Merchant_Modules::is_module_active( Merchant_Wishlist::MODULE_ID ) ) {
139 $css .= '
140 .breakdance-woocommerce .products .product .merchant-wishlist-button {
141 width: auto;
142 }
143 .single-product .merchant-wishlist-button {
144 position: static;
145 }
146 .single-product li .merchant-wishlist-button {
147 position: absolute;
148 }
149 .merchant-wishlist-button ~ .merchant-product-swatches .merchant-wishlist-button {
150 display: none !important;
151 }
152 ';
153 }
154
155 // Side Cart
156 if ( Merchant_Modules::is_module_active( Merchant_Side_Cart::MODULE_ID ) ) {
157 $css .= '
158 .bde-mini-cart-offcanvas-footer .woocommerce-mini-cart__buttons a {
159 padding: var(--bde-button-padding-base);
160 font-size: var(--bde-button-font-size);
161 line-height: var(--bde-button-line-height);
162 font-weight: var(--bde-button-font-weight);
163 border-radius: var(--bde-button-border-radius);
164 }
165 .merchant-floating-side-mini-cart-widget .merchant-quantity-inner .bde-quantity-button {
166 display: none !important;
167 }
168 ';
169 }
170
171 // Sticky Add to Cart
172 if ( Merchant_Modules::is_module_active( Merchant_Sticky_Add_To_Cart::MODULE_ID ) ) {
173 $css .= '
174 .merchant-sticky-add-to-cart-item .button {
175 padding: var(--bde-button-padding-base);
176 font-size: var(--bde-button-font-size);
177 line-height: var(--bde-button-line-height);
178 font-weight: var(--bde-button-font-weight);
179 border-radius: var(--bde-button-border-radius);
180 }
181 .merchant-sticky-add-to-cart-item .quantity {
182 position: relative;
183 }
184 .merchant-sticky-add-to-cart-item .quantity input {
185 width: 80px;
186 padding: 10px 5px;
187 text-align: center;
188 }
189 .merchant-sticky-add-to-cart-item .quantity input::-webkit-outer-spin-button,
190 .merchant-sticky-add-to-cart-item .quantity input::-webkit-inner-spin-button {
191 -webkit-appearance: none;
192 margin: 0;
193 }
194 .merchant-sticky-add-to-cart-item .quantity input[type=number] {
195 -moz-appearance: textfield;
196 }
197 ';
198 }
199
200 // Recently Viewed Products
201 if ( Merchant_Modules::is_module_active( Merchant_Recently_Viewed_Products::MODULE_ID ) ) {
202 $css .= '
203 .merchant-recently-viewed-products-section {
204 width: 100%;
205 }
206 @media (max-width: 991px) and (min-width: 768px) {
207 .merchant-recently-viewed-products-section .merchant-carousel-wrapper li {
208 min-width: 100%;
209 }
210 }
211 ';
212 }
213
214 // Product Audio/Video
215 if ( Merchant_Modules::is_module_active( Merchant_Product_Audio::MODULE_ID ) || Merchant_Modules::is_module_active( Merchant_Product_Video::MODULE_ID ) ) {
216 $css .= '
217 .products .bde-woo-product-footer {
218 margin: 0;
219 }
220 ';
221 }
222
223 // Waitlist
224 if ( Merchant_Modules::is_module_active( Merchant_Wait_List::MODULE_ID ) ) {
225 $css .= '
226 #merchant-wait-list input {
227 padding: 12px;
228 margin-top: 10px;
229 }
230 #merchant-wait-list .merchant-wait-list-submit {
231 padding: var(--bde-button-padding-base);
232 font-size: var(--bde-button-font-size);
233 line-height: var(--bde-button-line-height);
234 font-weight: var(--bde-button-font-weight);
235 border-radius: var(--bde-button-border-radius);
236 }
237 ';
238 }
239
240 // Advanced Reviews
241 if ( Merchant_Modules::is_module_active( Merchant_Advanced_Reviews::MODULE_ID ) ) {
242 $css .= '
243 .merchant-adv-reviews-media-carousel {
244 max-width: 100%;
245 }
246 .merchant-adv-reviews .star-rating > span {
247 text-indent: -9999px;
248 }
249 .merchant-adv-reviews .star-rating:before,
250 .merchant-adv-reviews-modal-rating .stars a {
251 background: var(--mrc-adv-reviews-stars-bg-color, #777) !important;
252 }
253
254 .merchant-adv-reviews .star-rating span,
255 .merchant-adv-reviews-modal-rating .stars.selected a,
256 .merchant-adv-reviews-modal-rating .stars:hover a {
257 background: var(--mrc-adv-reviews-stars-color, #FFA441) !important;
258 }
259 .merchant-adv-reviews-modal .star-rating {
260 position: relative;
261 height: var(--bde-woo-ratings__star-size);
262 width: calc(var(--bde-woo-ratings__star-size) * 5 + 16px);
263 color: transparent;
264 font-size: 0;
265 display: flex;
266 flex-direction: row;
267 margin-right: auto;
268 }
269 .merchant-adv-reviews-modal .star-rating:before {
270 content: "";
271 position: absolute;
272 inset: 0;
273 background: var(--mrc-adv-reviews-stars-bg-color, #777) !important;
274 mask-image: var(--bde-woo-ratings__empty-star-svg), var(--bde-woo-ratings__empty-star-svg), var(--bde-woo-ratings__empty-star-svg), var(--bde-woo-ratings__empty-star-svg), var(--bde-woo-ratings__empty-star-svg);
275 mask-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
276 mask-position: 0 center, calc(var(--bde-woo-ratings__star-size) + 4px) center, calc(var(--bde-woo-ratings__star-size) * 2 + 8px) center, calc(var(--bde-woo-ratings__star-size) * 3 + 12px) center, calc(var(--bde-woo-ratings__star-size) * 4 + 16px) center;
277 mask-size: contain;
278 }
279 .merchant-adv-reviews-modal .star-rating span {
280 position: relative;
281 z-index: 1;
282 background: var(--mrc-adv-reviews-stars-color, #FFA441) !important;
283 mask-image: var(--bde-woo-ratings__filled-star-svg), var(--bde-woo-ratings__filled-star-svg), var(--bde-woo-ratings__filled-star-svg), var(--bde-woo-ratings__filled-star-svg), var(--bde-woo-ratings__filled-star-svg);
284 mask-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
285 mask-position: 0 center, calc(var(--bde-woo-ratings__star-size) + 4px) center, calc(var(--bde-woo-ratings__star-size) * 2 + 8px) center, calc(var(--bde-woo-ratings__star-size) * 3 + 12px) center, calc(var(--bde-woo-ratings__star-size) * 4 + 16px) center;
286 mask-size: contain;
287 text-indent: -9999px;
288 }
289 ';
290 }
291
292 // Login Popup
293 if ( ! is_user_logged_in() && Merchant_Modules::is_module_active( Merchant_Login_Popup::MODULE_ID ) ) {
294 $css .= '
295 .merchant-login-popup-content .button {
296 padding: var(--bde-button-padding-base);
297 font-size: var(--bde-button-font-size);
298 line-height: var(--bde-button-line-height);
299 font-weight: var(--bde-button-font-weight);
300 border-radius: var(--bde-button-border-radius);
301 }
302 ';
303 }
304
305 // Checkout
306 if ( Merchant_Modules::is_module_active( Merchant_Checkout::MODULE_ID ) ) {
307 $css .= '
308 .woocommerce-checkout .woocommerce,
309 .woocommerce-checkout .shop_table {
310 width: 100%;
311 }
312 .merchant-pro-multi-step-wrapper li {
313 list-style: none;
314 }
315 .merchant-pro-multi-step-wrapper .form-row {
316 display: flex;
317 flex-direction: column;
318 gap: 10px;
319 }
320 .merchant-pro-multi-step-wrapper .form-row input,
321 .merchant-pro-multi-step-wrapper .form-row select,
322 .merchant-pro-multi-step-wrapper .form-row textarea {
323 width: 100%;
324 padding: 10px 15px;
325 }
326 .merchant-pro-multi-step-wrapper tr th:last-child, .merchant-pro-multi-step-wrapper tr td:last-child {
327 text-align: right;
328 }
329 .merchant-pro-multi-step-wrapper #payment ul {
330 padding: 0;
331 }
332 @media only screen and (min-width: 992px) {
333 .merchant-pro-sc-layout-shopify .merchant-pro-sc-form {
334 gap: 0 !important;
335 }
336 }
337 ';
338 }
339 }
340
341 return $css;
342 }
343 }
344
345 add_action( 'init', function() {
346 new Merchant_Breakdance_Builder();
347 } );
348 }
349