= (int) $ent_notif_limit ); $ent_notif_over = ( null !== $ent_notif_limit ) && ( $ent_enabled_cnt > (int) $ent_notif_limit ); // pre-existing multiples $billing_url = 'https://www.6rsh.com/billing'; $cartrevival_url = 'https://cartrevival.com'; $uid = get_current_user_id(); $cr_paid_dismissed = (bool) get_user_meta( $uid, 'sixrsh_cr_card_dismissed_paid', true ); // v1.7.0: the "Do more with 6rsh" paid-feature discovery card (shown once a // merchant has abandoned-cart recovery set up). Dismissible per-user via the // shared sixrsh_dismiss_cr_card AJAX handler (card = discovery). $discovery_dismissed = (bool) get_user_meta( $uid, 'sixrsh_cr_card_dismissed_discovery', true ); $dir_attr = is_rtl() ? 'rtl' : 'ltr'; // ── Coexistence with CartRevival (see SixRsh_Coexistence) ──────────────────── // $cr_yielding = CartRevival owns the recovery engine and 6rsh has stepped // aside. $cr_override = merchant deliberately kept 6rsh as the cart engine. $cr_plugin_active = class_exists( 'SixRsh_Coexistence' ) ? SixRsh_Coexistence::cartrevival_active() : ( in_array( 'cartrevival/cartrevival.php', (array) get_option( 'active_plugins', array() ), true ) || class_exists( 'CartRevival' ) ); $cr_yielding = class_exists( 'SixRsh_Coexistence' ) && SixRsh_Coexistence::should_yield_cart_engine(); $cr_override = class_exists( 'SixRsh_Coexistence' ) && SixRsh_Coexistence::override_active(); // Build the all-events list: special events first, then all WC statuses. $all_events = array(); $all_events['order_placed'] = 'Order Placed'; $all_events['cod_confirmation'] = 'Cash-on-delivery confirmation (Confirm / Cancel) — free'; $all_events['new_customer'] = 'New Registration'; if ( function_exists( 'wc_get_order_statuses' ) ) { foreach ( wc_get_order_statuses() as $status_key => $status_label ) { $all_events[ $status_key ] = $status_label; } } // Per-event enabled/template from per-option storage. $event_enabled = array(); $event_template = array(); foreach ( $all_events as $slug => $label ) { $event_enabled[ $slug ] = (bool) get_option( 'sixrsh_event_' . $slug . '_enabled', false ); $raw = get_option( 'sixrsh_event_' . $slug . '_template', '' ); $event_template[ $slug ] = $raw ? json_decode( $raw, true ) : null; } // "Last Sent" per event from logs table. $last_sent_map = array(); $lt = $wpdb->prefix . 'sixrsh_logs'; if ( $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $lt ) ) === $lt ) { // phpcs:disable WordPress.DB.DirectDatabaseQuery,WordPress.DB.PreparedSQL.InterpolatedNotPrepared $ls_rows = $wpdb->get_results( "SELECT event_type, MAX(created_at) AS last_sent FROM {$wpdb->prefix}sixrsh_logs WHERE status='success' GROUP BY event_type", ARRAY_A ); // phpcs:enable if ( is_array( $ls_rows ) ) { foreach ( $ls_rows as $ls_row ) { $last_sent_map[ $ls_row['event_type'] ] = $ls_row['last_sent']; } } } // Template mismatch warning: all configured templates point to the same ID. $all_tmpl_ids = array_filter( array_map( static fn( $t ) => $t['template_id'] ?? null, array_filter( $event_template ) ) ); $show_mismatch_warning = count( $all_tmpl_ids ) > 1 && count( array_unique( $all_tmpl_ids ) ) === 1; // Checklist: any notification enabled? $c_notification_on = in_array( true, $event_enabled, true ); $c_widget_on = ! empty( $settings['widget']['enabled'] ) || ! empty( $settings['web_chat']['enabled'] ); // Default test phone to connected phone when none configured. if ( empty( $settings['test_phone'] ) ) { $settings['test_phone'] = $phone; } // For legacy logs tab event filter, keep $event_labels as a subset. $event_labels = array_slice( $all_events, 0, 8, true ); $page_url = admin_url( 'admin.php?page=6rsh-messaging-notifications' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended $setup_done = sanitize_key( $_GET['setup_done'] ?? '' ) === '1'; ?>
⚠️ Cannot reach 6rsh.com — WhatsApp notifications are paused until reconnected. Go to Connection tab to test →
✅ Setup complete! Review your notification settings below.
🎉 You're all set! WhatsApp notifications are now active for your store.
⚠️ All events are mapped to the same template. Verify each event uses the correct template in the table below.
No approved WhatsApp templates found. Templates must be approved by Meta before use.
Create Template in 6rsh →|
0 ) : ?> Variables not configured — Not mapped — |
Reminder timing and sequences are configured in your 6rsh dashboard.
Configure in 6rsh →
✓
Chats go to your connected WhatsApp number: No WhatsApp number connected yet.
6rsh WhatsApp v