| @@ -72,9 +72,9 @@ | ||
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * Modify the checkout order received url to next step |
| 75 | 75 | */ |
| 76 | - add_filter('woocommerce_get_checkout_order_received_url', [$this, 'redirect_to_funnel_thankyou_page'], 10, 2); | |
| 76 | + add_filter('woocommerce_get_checkout_order_received_url', [$this, 'redirect_to_funnel_thankyou_page'], 1000, 2); | |
| 77 | 77 | |
| 78 | 78 | /* |
| 79 | 79 | * This hook will be triggered once the elementor data is saved. |
| 80 | 80 | * Will be placed this hook on another class in future. |
| @@ -286,8 +286,15 @@ | ||
| 286 | 286 | */ |
| 287 | 287 | public function wpfnl_order_bump_cart_item_quantity($quantity, $cart_item, $cart_item_key) |
| 288 | 288 | { |
| 289 | 289 | if (isset($cart_item['wpfnl_order_bump']) && $cart_item['wpfnl_order_bump'] && isset($cart_item['wpfnl_ob_quantity'])) { |
| 290 | + // When the checkout step has quantity selection enabled, let the bump | |
| 291 | + // item go through the same editable quantity control as every other | |
| 292 | + // cart item instead of forcing a fixed, non-editable badge. | |
| 293 | + $step_id = wp_doing_ajax() ? Wpfnl_functions::is_funnel_checkout_page()['id'] : get_the_ID(); | |
| 294 | + if ( 'yes' === get_post_meta( $step_id, '_wpfnl_quantity_support', true ) ) { | |
| 295 | + return $quantity; | |
| 296 | + } | |
| 290 | 297 | return ' <strong class="product-quantity">' . $cart_item['quantity'] . '</strong>'; |
| 291 | 298 | } |
| 292 | 299 | return $quantity; |
| 293 | 300 | } |
| @@ -346,16 +353,19 @@ | ||
| 346 | 353 | |
| 347 | 354 | |
| 348 | 355 | public function init_wp_actions() |
| 349 | 356 | { |
| 350 | - if (Wpfnl_functions::is_funnel_step_page('')) { | |
| 357 | + $is_ajax = wp_doing_ajax() || isset( $_GET['wc-ajax'] ); | |
| 358 | + if ( Wpfnl_functions::is_funnel_step_page('') || $is_ajax ) { | |
| 351 | 359 | /** |
| 352 | 360 | * Enqueue public styles |
| 353 | 361 | */ |
| 354 | - add_action('wp_enqueue_scripts', array($this, 'enqueue_styles')); | |
| 355 | - add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts')); | |
| 356 | - add_action('wp_enqueue_scripts', array($this, 'remove_theme_styles')); | |
| 357 | - add_filter('woocommerce_enqueue_styles', array($this, 'enqueue_wc_styles'), 9999); | |
| 362 | + if ( ! $is_ajax ) { | |
| 363 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles')); | |
| 364 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts')); | |
| 365 | + add_action('wp_enqueue_scripts', array($this, 'remove_theme_styles')); | |
| 366 | + add_filter('woocommerce_enqueue_styles', array($this, 'enqueue_wc_styles'), 9999); | |
| 367 | + } | |
| 358 | 368 | |
| 359 | 369 | add_filter('woocommerce_locate_template', array($this, 'wpfunnels_woocommerce_locate_template'), 20, 3); |
| 360 | 370 | } |
| 361 | 371 | } |
| @@ -1223,10 +1233,12 @@ | ||
| 1223 | 1233 | |
| 1224 | 1234 | // Extract user's email for potential login and registration. |
| 1225 | 1235 | $login = $user_info['email'] ? strstr($user_info['email'], '@', true) : ''; |
| 1226 | 1236 | |
| 1227 | - // Check WordPress site-wide registration setting FIRST. | |
| 1228 | - $can_register = get_option('users_can_register'); | |
| 1237 | + // Kept as an early-out next to the request-supplied flag; the | |
| 1238 | + // authoritative check lives in create_user_optin_allow_registration(), | |
| 1239 | + // which every registration path routes through. | |
| 1240 | + $can_register = get_option('users_can_register'); | |
| 1229 | 1241 | |
| 1230 | 1242 | // Check if opt-in registration is allowed and perform related actions. |
| 1231 | 1243 | if ( $can_register && !empty($post_data['optin_allow_registration']) && $post_data['optin_allow_registration'] == 'yes') { |
| 1232 | 1244 | // Create user account based on the extracted login and post data. |