| @@ -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. |
| @@ -1281,9 +1293,9 @@ | ||
| 1281 | 1293 | $admin_bar->add_node( |
| 1282 | 1294 | array( |
| 1283 | 1295 | 'id' => 'edit-funnel', |
| 1284 | 1296 | 'title' => '<span class="ab-icon dashicons dashicons-edit"></span>' . esc_html__('Edit Funnel', 'wpfnl'), |
| 1285 | - 'href' => admin_url("admin.php?page=edit_funnel&id={$funnel_id}&step_id=0"), | |
| 1297 | + 'href' => \WPFunnels\Wpfnl_functions::get_funnel_edit_url($funnel_id), | |
| 1286 | 1298 | 'meta' => array( |
| 1287 | 1299 | 'class' => 'wpf-admin-bar-edit-funnel-menu-item', |
| 1288 | 1300 | ), |
| 1289 | 1301 | ) |
| @@ -1356,9 +1368,9 @@ | ||
| 1356 | 1368 | if ( ! empty( $order_bump_settings ) ) { |
| 1357 | 1369 | foreach ( $order_bump_settings as $key => $settings ) { |
| 1358 | 1370 | if ( isset( $settings['product'] ) ) { |
| 1359 | 1371 | $product = wc_get_product( $settings['product'] ); |
| 1360 | - if ( $product && $product->is_type( 'variable' ) ) { | |
| 1372 | + if ( $product && $product->is_type( array( 'variable', 'variable-subscription' ) ) ) { | |
| 1361 | 1373 | wc_get_template( |
| 1362 | 1374 | 'variable-product-modal.php', |
| 1363 | 1375 | array( |
| 1364 | 1376 | 'product' => $product, |