= (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'; ?>

✓ Saved

● ● Not connected Run Setup Wizard

⚠️ 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 →  

$label ) : $enabled = $event_enabled[ $slug ] ?? false; $tmpl = $event_template[ $slug ] ?? null; $mapped_id = $tmpl['template_id'] ?? ''; $mapped_name = $tmpl['template_name'] ?? ''; // Template pill + body preview. $body_preview = ''; if ( $mapped_id && isset( $template_index[ $mapped_id ] ) ) { $t_obj = $template_index[ $mapped_id ]; if ( ! empty( $t_obj['components'] ) ) { foreach ( $t_obj['components'] as $comp ) { if ( strtolower( $comp['type'] ?? '' ) === 'body' && ! empty( $comp['text'] ) ) { $body_preview = mb_substr( $comp['text'], 0, 60 ); break; } } } } // "Last Sent". $ls = $last_sent_map[ $slug ] ?? '—'; if ( $ls !== '—' ) { $ls_ts = strtotime( $ls ); $ls = $ls_ts ? human_time_diff( $ls_ts, time() ) . ' ago' : $ls; } // Variable count for mapped template. $var_count = 0; if ( $mapped_id ) { foreach ( $templates as $_t ) { if ( (string) ( $_t['id'] ?? '' ) === (string) $mapped_id ) { $var_count = (int) ( $_t['variables_count'] ?? 0 ); break; } } } // Saved variable mapping. $raw_vars = get_option( 'sixrsh_event_' . $slug . '_variables', '' ); $var_mapping = $raw_vars ? json_decode( $raw_vars, true ) : array(); if ( ! is_array( $var_mapping ) ) $var_mapping = array(); // Build summary string for collapsed view. $var_sum_parts = array(); foreach ( $var_mapping as $_vm ) { $_label = $field_options[ $_vm['field'] ?? '' ] ?? ( $_vm['field'] ?? '' ); $var_sum_parts[] = '{{' . ( $_vm['key'] ?? '' ) . '}}=' . $_label; } $var_summary = implode( ', ', $var_sum_parts ); ?>

0 ) : ?>
Variables not configured — Not mapped —
'Completed', 'wc-processing' => 'Processing' ); ?>

>
⚙️

class="regular-text" style="min-width:340px" value="" >

—
—
—
✨

→

📊

💬

Reminder timing and sequences are configured in your 6rsh dashboard.

Configure in 6rsh →

→

✓

SixRsh_Admin::t( 'Automatic (right, left on Arabic pages)', 'تلقائي (يمين، ويسار في الصفحات العربية)' ), 'right' => SixRsh_Admin::t( 'Right', 'يمين' ), 'left' => SixRsh_Admin::t( 'Left', 'يسار' ), ) as $pos_value => $pos_label ) : ?>

Chats go to your connected WhatsApp number: No WhatsApp number connected yet.

6rsh WhatsApp v