PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.13.3
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.13.3
3.13.3 3.13.2 3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 All 261 releases
← All changes | includes/core/widgets/bricks/Checkout.php +326 -1 3.11.1 → 3.13.3 View file →
@@ -48,8 +48,29 @@
48 48 return esc_html__('Checkout', 'wpfnl');
49 49 }
50 50
51 51 /**
52 + * Get WordPress user roles for display condition control.
53 + *
54 + * @return array
55 + * @since 3.1.0
56 + */
57 + protected function get_wp_user_roles()
58 + {
59 + $roles = [ 'none' => esc_html__( 'None', 'wpfnl' ) ];
60 +
61 + if ( ! function_exists( 'get_editable_roles' ) ) {
62 + require_once ABSPATH . 'wp-admin/includes/user.php';
63 + }
64 +
65 + foreach ( get_editable_roles() as $role_key => $role_info ) {
66 + $roles[ $role_key ] = $role_info['name'];
67 + }
68 +
69 + return $roles;
70 + }
71 +
72 + /**
52 73 * Get layout types
53 74 *
54 75 * @return array
55 76 */
@@ -131,9 +152,195 @@
131 152 ],
132 153 'inline' => true,
133 154 ];
134 155
156 + // Responsive Display
157 + $this->controls['responsiveSeparator'] = [
158 + 'tab' => 'content',
159 + 'group' => 'wpfunnels_checkout_content',
160 + 'label' => esc_html__( 'Responsive Display', 'wpfnl' ),
161 + 'type' => 'separator',
162 + ];
135 163
164 + $this->controls['hide_on_desktop'] = [
165 + 'tab' => 'content',
166 + 'group' => 'wpfunnels_checkout_content',
167 + 'label' => esc_html__( 'Hide on Desktop (≥ 1200px)', 'wpfnl' ),
168 + 'type' => 'checkbox',
169 + 'default' => false,
170 + 'description' => esc_html__( 'Hide checkout on desktop devices (window width >= 1200px)', 'wpfnl' ),
171 + ];
172 +
173 + $this->controls['hide_on_tablet'] = [
174 + 'tab' => 'content',
175 + 'group' => 'wpfunnels_checkout_content',
176 + 'label' => esc_html__( 'Hide on Tablet (768px – 1199px)', 'wpfnl' ),
177 + 'type' => 'checkbox',
178 + 'default' => false,
179 + 'description' => esc_html__( 'Hide checkout on tablet devices (window width 768px - 1199px)', 'wpfnl' ),
180 + ];
181 +
182 + $this->controls['hide_on_mobile'] = [
183 + 'tab' => 'content',
184 + 'group' => 'wpfunnels_checkout_content',
185 + 'label' => esc_html__( 'Hide on Mobile (≤ 767px)', 'wpfnl' ),
186 + 'type' => 'checkbox',
187 + 'default' => false,
188 + 'description' => esc_html__( 'Hide checkout on mobile devices (window width <= 767px)', 'wpfnl' ),
189 + ];
190 +
191 + // Display Conditions
192 + $this->controls['displayConditionSeparator'] = [
193 + 'tab' => 'content',
194 + 'group' => 'wpfunnels_checkout_content',
195 + 'label' => esc_html__( 'Display Conditions', 'wpfnl' ),
196 + 'type' => 'separator',
197 + ];
198 +
199 + $this->controls['display_condition_type'] = [
200 + 'tab' => 'content',
201 + 'group' => 'wpfunnels_checkout_content',
202 + 'label' => esc_html__( 'Display Condition', 'wpfnl' ),
203 + 'type' => 'select',
204 + 'options' => [
205 + 'none' => esc_html__( 'None', 'wpfnl' ),
206 + 'user_state' => esc_html__( 'User State', 'wpfnl' ),
207 + 'user_role' => esc_html__( 'User Role', 'wpfnl' ),
208 + 'browser' => esc_html__( 'Browser', 'wpfnl' ),
209 + 'operating_system' => esc_html__( 'Operating System', 'wpfnl' ),
210 + 'day' => esc_html__( 'Day', 'wpfnl' ),
211 + ],
212 + 'inline' => false,
213 + 'default' => 'none',
214 + ];
215 +
216 + // User State
217 + $this->controls['hide_from_logged_in'] = [
218 + 'tab' => 'content',
219 + 'group' => 'wpfunnels_checkout_content',
220 + 'label' => esc_html__( 'Hide From Logged In User', 'wpfnl' ),
221 + 'type' => 'checkbox',
222 + 'default' => false,
223 + 'required' => [ 'display_condition_type', '=', 'user_state' ],
224 + ];
225 +
226 + $this->controls['hide_from_logged_out'] = [
227 + 'tab' => 'content',
228 + 'group' => 'wpfunnels_checkout_content',
229 + 'label' => esc_html__( 'Hide From Logged Out User', 'wpfnl' ),
230 + 'type' => 'checkbox',
231 + 'default' => false,
232 + 'required' => [ 'display_condition_type', '=', 'user_state' ],
233 + ];
234 +
235 + // User Role
236 + $this->controls['hide_for_user_role'] = [
237 + 'tab' => 'content',
238 + 'group' => 'wpfunnels_checkout_content',
239 + 'label' => esc_html__( 'Hide For User Role', 'wpfnl' ),
240 + 'type' => 'select',
241 + 'options' => $this->get_wp_user_roles(),
242 + 'default' => 'none',
243 + 'required' => [ 'display_condition_type', '=', 'user_role' ],
244 + ];
245 +
246 + // Browser
247 + $this->controls['hide_on_browser'] = [
248 + 'tab' => 'content',
249 + 'group' => 'wpfunnels_checkout_content',
250 + 'label' => esc_html__( 'Hide On Browser', 'wpfnl' ),
251 + 'type' => 'select',
252 + 'options' => [
253 + 'none' => esc_html__( 'None', 'wpfnl' ),
254 + 'mozilla' => esc_html__( 'Mozilla Firefox', 'wpfnl' ),
255 + 'chrome' => esc_html__( 'Google Chrome', 'wpfnl' ),
256 + 'opera_mini' => esc_html__( 'Opera Mini', 'wpfnl' ),
257 + 'safari' => esc_html__( 'Safari', 'wpfnl' ),
258 + 'edge' => esc_html__( 'Microsoft Edge', 'wpfnl' ),
259 + ],
260 + 'default' => 'none',
261 + 'required' => [ 'display_condition_type', '=', 'browser' ],
262 + ];
263 +
264 + // Operating System
265 + $this->controls['hide_on_os'] = [
266 + 'tab' => 'content',
267 + 'group' => 'wpfunnels_checkout_content',
268 + 'label' => esc_html__( 'Hide On Operating System', 'wpfnl' ),
269 + 'type' => 'select',
270 + 'options' => [
271 + 'none' => esc_html__( 'None', 'wpfnl' ),
272 + 'ios' => esc_html__( 'iOS', 'wpfnl' ),
273 + 'android' => esc_html__( 'Android', 'wpfnl' ),
274 + 'windows' => esc_html__( 'Windows', 'wpfnl' ),
275 + 'macos' => esc_html__( 'MacOS', 'wpfnl' ),
276 + 'linux' => esc_html__( 'Linux', 'wpfnl' ),
277 + 'sunos' => esc_html__( 'SunOS', 'wpfnl' ),
278 + 'openbsd' => esc_html__( 'OpenBSD', 'wpfnl' ),
279 + ],
280 + 'default' => 'none',
281 + 'required' => [ 'display_condition_type', '=', 'operating_system' ],
282 + ];
283 +
284 + // Day
285 + $this->controls['disable_on_days'] = [
286 + 'tab' => 'content',
287 + 'group' => 'wpfunnels_checkout_content',
288 + 'label' => esc_html__( 'Select Days You Want To Disable', 'wpfnl' ),
289 + 'type' => 'select',
290 + 'multiple' => true,
291 + 'options' => [
292 + 'monday' => esc_html__( 'Monday', 'wpfnl' ),
293 + 'tuesday' => esc_html__( 'Tuesday', 'wpfnl' ),
294 + 'wednesday' => esc_html__( 'Wednesday', 'wpfnl' ),
295 + 'thursday' => esc_html__( 'Thursday', 'wpfnl' ),
296 + 'friday' => esc_html__( 'Friday', 'wpfnl' ),
297 + 'saturday' => esc_html__( 'Saturday', 'wpfnl' ),
298 + 'sunday' => esc_html__( 'Sunday', 'wpfnl' ),
299 + ],
300 + 'default' => [],
301 + 'required' => [ 'display_condition_type', '=', 'day' ],
302 + ];
303 +
304 + // Animation
305 + $this->controls['animationSeparator'] = [
306 + 'tab' => 'content',
307 + 'group' => 'wpfunnels_checkout_content',
308 + 'label' => esc_html__( 'Animation', 'wpfnl' ),
309 + 'type' => 'separator',
310 + ];
311 +
312 + $this->controls['entrance_animation'] = [
313 + 'tab' => 'content',
314 + 'group' => 'wpfunnels_checkout_content',
315 + 'label' => esc_html__( 'Entrance Animation', 'wpfnl' ),
316 + 'type' => 'select',
317 + 'options' => [
318 + '' => esc_html__( 'None', 'wpfnl' ),
319 + 'fadeIn' => esc_html__( 'Fade In', 'wpfnl' ),
320 + 'fadeInUp' => esc_html__( 'Fade In Up', 'wpfnl' ),
321 + 'fadeInDown' => esc_html__( 'Fade In Down', 'wpfnl' ),
322 + 'fadeInLeft' => esc_html__( 'Fade In Left', 'wpfnl' ),
323 + 'fadeInRight'=> esc_html__( 'Fade In Right', 'wpfnl' ),
324 + 'zoomIn' => esc_html__( 'Zoom In', 'wpfnl' ),
325 + 'zoomInUp' => esc_html__( 'Zoom In Up', 'wpfnl' ),
326 + 'bounceIn' => esc_html__( 'Bounce In', 'wpfnl' ),
327 + 'bounceInUp' => esc_html__( 'Bounce In Up', 'wpfnl' ),
328 + 'slideInUp' => esc_html__( 'Slide In Up', 'wpfnl' ),
329 + 'slideInLeft'=> esc_html__( 'Slide In Left', 'wpfnl' ),
330 + 'slideInRight'=> esc_html__( 'Slide In Right', 'wpfnl' ),
331 + 'flipInX' => esc_html__( 'Flip In X', 'wpfnl' ),
332 + 'flipInY' => esc_html__( 'Flip In Y', 'wpfnl' ),
333 + 'pulse' => esc_html__( 'Pulse', 'wpfnl' ),
334 + 'tada' => esc_html__( 'Tada', 'wpfnl' ),
335 + 'wobble' => esc_html__( 'Wobble', 'wpfnl' ),
336 + ],
337 + 'inline' => false,
338 + 'placeholder' => esc_html__( 'None', 'wpfnl' ),
339 + 'default' => '',
340 + 'description' => esc_html__( 'Animation plays when the checkout enters the viewport on the live page.', 'wpfnl' ),
341 + ];
342 +
136 343 }
137 344
138 345
139 346 /**
@@ -471,8 +678,12 @@
471 678 ],
472 679 [
473 680 'property' => 'font',
474 681 'selector' => '.wpfnl-checkout .woocommerce-additional-fields > h3',
682 + ],
683 + [
684 + 'property' => 'font',
685 + 'selector' => '.wpfnl-checkout .woocommerce-shipping-fields .shipping-field-title',
475 686 ]
476 687 ],
477 688 ];
478 689 $this->controls['shipping_heading_margin'] = [
@@ -487,8 +698,12 @@
487 698 [
488 699 'property' => 'margin',
489 700 'selector' => '.wpfnl-checkout .woocommerce-additional-fields > h3',
490 701 ],
702 + [
703 + 'property' => 'margin',
704 + 'selector' => '.wpfnl-checkout .woocommerce-shipping-fields .shipping-field-title',
705 + ],
491 706 ],
492 707 ];
493 708 $this->controls['shipping_heading_padding'] = [
494 709 'group' => 'wpfunnels_checkout_shipping_style',
@@ -502,8 +717,12 @@
502 717 [
503 718 'property' => 'padding',
504 719 'selector' => '.wpfnl-checkout .woocommerce-shipping-fields #ship-to-different-address',
505 720 ],
721 + [
722 + 'property' => 'padding',
723 + 'selector' => '.wpfnl-checkout .woocommerce-shipping-fields .shipping-field-title',
724 + ],
506 725 ],
507 726 ];
508 727
509 728
@@ -2117,14 +2336,103 @@
2117 2336 // We need the form element ID to recover the element settings on form submit
2118 2337 $this->set_attribute( '_root', 'data-element-id', $this->id );
2119 2338
2120 2339 $settings = $this->settings;
2340 +
2341 + // ---- Display Conditions ----------------------------------------
2342 + $display_condition = ! empty( $settings['display_condition_type'] ) ? $settings['display_condition_type'] : 'none';
2343 +
2344 + if ( $display_condition === 'user_state' ) {
2345 + $hide_logged_in = ! empty( $settings['hide_from_logged_in'] );
2346 + $hide_logged_out = ! empty( $settings['hide_from_logged_out'] );
2347 +
2348 + if ( $hide_logged_in && is_user_logged_in() ) {
2349 + return;
2350 + }
2351 + if ( $hide_logged_out && ! is_user_logged_in() ) {
2352 + return;
2353 + }
2354 +
2355 + } elseif ( $display_condition === 'user_role' ) {
2356 + $hide_for_user_role = ! empty( $settings['hide_for_user_role'] ) ? $settings['hide_for_user_role'] : 'none';
2357 +
2358 + if ( $hide_for_user_role !== 'none' && is_user_logged_in() ) {
2359 + $user = wp_get_current_user();
2360 + if ( in_array( $hide_for_user_role, $user->roles ) ) {
2361 + return;
2362 + }
2363 + }
2364 +
2365 + } elseif ( $display_condition === 'day' ) {
2366 + $disable_on_days = ! empty( $settings['disable_on_days'] ) ? $settings['disable_on_days'] : [];
2367 +
2368 + if ( ! empty( $disable_on_days ) && is_array( $disable_on_days ) ) {
2369 + $current_day = strtolower( date( 'l' ) ); // e.g., 'monday'
2370 + if ( in_array( $current_day, $disable_on_days ) ) {
2371 + return;
2372 + }
2373 + }
2374 +
2375 + } elseif ( $display_condition === 'browser' ) {
2376 + $hide_on_browser = ! empty( $settings['hide_on_browser'] ) ? $settings['hide_on_browser'] : 'none';
2377 +
2378 + if ( $hide_on_browser !== 'none' ) {
2379 + $user_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : '';
2380 + $current_browser = '';
2381 +
2382 + if ( strpos( $user_agent, 'edg' ) !== false ) {
2383 + $current_browser = 'edge';
2384 + } elseif ( strpos( $user_agent, 'opr' ) !== false || strpos( $user_agent, 'opera' ) !== false ) {
2385 + $current_browser = 'opera_mini';
2386 + } elseif ( strpos( $user_agent, 'chrome' ) !== false ) {
2387 + $current_browser = 'chrome';
2388 + } elseif ( strpos( $user_agent, 'safari' ) !== false ) {
2389 + $current_browser = 'safari';
2390 + } elseif ( strpos( $user_agent, 'firefox' ) !== false ) {
2391 + $current_browser = 'mozilla';
2392 + }
2393 +
2394 + if ( $current_browser === $hide_on_browser ) {
2395 + return;
2396 + }
2397 + }
2398 +
2399 + } elseif ( $display_condition === 'operating_system' ) {
2400 + $hide_on_os = ! empty( $settings['hide_on_os'] ) ? $settings['hide_on_os'] : 'none';
2401 +
2402 + if ( $hide_on_os !== 'none' ) {
2403 + $user_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : '';
2404 + $current_os = '';
2405 +
2406 + if ( strpos( $user_agent, 'windows' ) !== false || strpos( $user_agent, 'win32' ) !== false || strpos( $user_agent, 'win64' ) !== false ) {
2407 + $current_os = 'windows';
2408 + } elseif ( strpos( $user_agent, 'macintosh' ) !== false || strpos( $user_agent, 'mac os x' ) !== false ) {
2409 + $current_os = 'macos';
2410 + } elseif ( strpos( $user_agent, 'linux' ) !== false && strpos( $user_agent, 'android' ) === false ) {
2411 + $current_os = 'linux';
2412 + } elseif ( strpos( $user_agent, 'android' ) !== false ) {
2413 + $current_os = 'android';
2414 + } elseif ( strpos( $user_agent, 'iphone' ) !== false || strpos( $user_agent, 'ipad' ) !== false || strpos( $user_agent, 'ipod' ) !== false ) {
2415 + $current_os = 'ios';
2416 + } elseif ( strpos( $user_agent, 'sunos' ) !== false ) {
2417 + $current_os = 'sunos';
2418 + } elseif ( strpos( $user_agent, 'openbsd' ) !== false ) {
2419 + $current_os = 'openbsd';
2420 + }
2421 +
2422 + if ( $current_os === $hide_on_os ) {
2423 + return;
2424 + }
2425 + }
2426 + }
2427 + // ---- End Display Conditions ------------------------------------
2428 +
2121 2429 $checkout = WC()->checkout();
2122 2430 $checkout_id = $this->post_id;
2123 2431
2124 2432 //----Start Coupon Enabler----//
2125 2433 $coupon_enabler = get_post_meta($this->post_id, '_wpfnl_checkout_coupon', true);
2126 - if ( $coupon_enabler != 'yes' ) {
2434 + if ( 'no' === $coupon_enabler ) {
2127 2435 remove_action('woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10);
2128 2436 }
2129 2437 //----End Coupon Enabler----//
2130 2438
@@ -2169,8 +2477,25 @@
2169 2477 */
2170 2478 if('wpfnl-modern-multistep' === $checkout_layout ) {
2171 2479 $checkout_layout .= ' wpfnl-modern-checkout';
2172 2480 }
2481 +
2482 + // Add responsive classes
2483 + if ( ! empty( $settings['hide_on_desktop'] ) ) {
2484 + $checkout_layout .= ' wpfnl-hide-desktop';
2485 + }
2486 + if ( ! empty( $settings['hide_on_tablet'] ) ) {
2487 + $checkout_layout .= ' wpfnl-hide-tablet';
2488 + }
2489 + if ( ! empty( $settings['hide_on_mobile'] ) ) {
2490 + $checkout_layout .= ' wpfnl-hide-mobile';
2491 + }
2492 +
2493 + // Add animation class
2494 + $animation = ! empty( $settings['entrance_animation'] ) ? $settings['entrance_animation'] : '';
2495 + if ( $animation ) {
2496 + $checkout_layout .= ' wpfnl-animation ' . esc_attr( $animation );
2497 + }
2173 2498
2174 2499 query_posts('post_type="checkout"');
2175 2500
2176 2501 // load woo templates from wpf plugin