';
AIFLT_UI::empty_state('store', __('WooCommerce is needed', 'ai-flash-tune'), __('Abandoned carts come from your WooCommerce store. Activate WooCommerce to start.', 'ai-flash-tune'), '' . esc_html($aiflt_wc['button_text']) . '');
echo '';
return;
}
// AI Flash Tune Pro adds its AI tools to each cart through this hook.
$aiflt_has_pro_tools = (bool) has_action('aiflt_cart_winback');
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Opens one cart from a link.
$aiflt_open_session = isset($_GET['session_id']) ? sanitize_text_field(wp_unslash($_GET['session_id'])) : '';
$aiflt_period = AIFLT_UI::period(30);
// phpcs:disable WordPress.Security.NonceVerification.Recommended -- Read-only filters.
$aiflt_customer_type = isset($_GET['customer_type']) ? sanitize_key(wp_unslash($_GET['customer_type'])) : 'all';
$aiflt_contact = isset($_GET['contact']) ? sanitize_key(wp_unslash($_GET['contact'])) : 'all';
$aiflt_current_page = isset($_GET['paged']) ? max(1, absint($_GET['paged'])) : 1;
// phpcs:enable WordPress.Security.NonceVerification.Recommended
$aiflt_customer_type = in_array($aiflt_customer_type, ['all', 'guest', 'registered'], true) ? $aiflt_customer_type : 'all';
$aiflt_contact = in_array($aiflt_contact, ['all', 'yes', 'no'], true) ? $aiflt_contact : 'all';
$aiflt_per_page = 20;
$aiflt_data = AIFLT_Abandoned_Carts_Logic::get_abandoned_carts($aiflt_period['start'], $aiflt_period['end'], $aiflt_per_page, ($aiflt_current_page - 1) * $aiflt_per_page, $aiflt_customer_type, $aiflt_contact);
$aiflt_counts = (array) ($aiflt_data['counts'] ?? []);
$aiflt_rec_rows = AIFLT_Cart_Recovery::rows_for_sessions(wp_list_pluck((array) $aiflt_data['carts'], 'session_id'));
$aiflt_rec_stats = AIFLT_Cart_Recovery::stats($aiflt_period['start'], $aiflt_period['end']);
$aiflt_carts = (array) $aiflt_data['carts'];
$aiflt_total = (int) $aiflt_data['total_carts'];
$aiflt_pages = max(1, (int) ceil($aiflt_total / $aiflt_per_page));
$aiflt_metrics = AIFLT_Abandoned_Carts_Logic::get_abandoned_carts_metrics($aiflt_period['start'], $aiflt_period['end'], $aiflt_customer_type);
$aiflt_count = (int) $aiflt_metrics['total_abandoned_carts'];
$aiflt_value = (float) $aiflt_metrics['total_lost_revenue'];
$aiflt_keep = ['page' => 'aiflt-abandoned-carts', 'customer_type' => $aiflt_customer_type, 'contact' => $aiflt_contact];
$aiflt_period_args = $aiflt_period['range'] === 'custom'
? ['range' => 'custom', 'start_date' => $aiflt_period['start'], 'end_date' => $aiflt_period['end']]
: ['range' => $aiflt_period['range']];
AIFLT_UI::period_toolbar(
$aiflt_period,
['page' => 'aiflt-abandoned-carts', 'customer_type' => $aiflt_customer_type, 'contact' => $aiflt_contact],
AIFLT_UI::segmented(
['all' => __('All shoppers', 'ai-flash-tune'), 'guest' => __('Guests', 'ai-flash-tune'), 'registered' => __('Customers', 'ai-flash-tune')],
$aiflt_customer_type,
'customer_type',
['page' => 'aiflt-abandoned-carts', 'contact' => $aiflt_contact] + $aiflt_period_args,
__('Shopper type', 'ai-flash-tune')
)
);
?>
0 ? 'leak' : '');
AIFLT_UI::stat(__('Value left behind', 'ai-flash-tune'), wc_price($aiflt_value), esc_html__('cart totals when shoppers left', 'ai-flash-tune'));
AIFLT_UI::stat(
__('Recovered', 'ai-flash-tune'),
wc_price($aiflt_rec_stats['revenue']),
$aiflt_rec_stats['carts_emailed'] > 0
/* translators: 1: number of carts, 2: percentage of reminded carts */
? esc_html(sprintf(_n('%1$s cart won back · %2$s%% of reminded', '%1$s carts won back · %2$s%% of reminded', $aiflt_rec_stats['recovered'], 'ai-flash-tune'), number_format_i18n($aiflt_rec_stats['recovered']), number_format_i18n($aiflt_rec_stats['recovery_rate'], 1)))
/* translators: %s: number of carts */
: esc_html(sprintf(_n('%s cart won back', '%s carts won back', $aiflt_rec_stats['recovered'], 'ai-flash-tune'), number_format_i18n($aiflt_rec_stats['recovered']))),
$aiflt_rec_stats['recovered'] > 0 ? 'good' : ''
);
AIFLT_UI::stat(
__('Reminders sent', 'ai-flash-tune'),
esc_html(number_format_i18n($aiflt_rec_stats['emails_sent'])),
$aiflt_rec_stats['carts_emailed'] > 0
/* translators: 1: percentage who opened a reminder, 2: percentage who came back to their cart */
? esc_html(sprintf(__('%1$s%% opened · %2$s%% came back', 'ai-flash-tune'), number_format_i18n($aiflt_rec_stats['open_rate'], 1), number_format_i18n($aiflt_rec_stats['click_rate'], 1)))
: esc_html__('none sent in this period', 'ai-flash-tune')
);
?>
sprintf(__('All · %s', 'ai-flash-tune'), number_format_i18n((int) ($aiflt_counts['all'] ?? 0))),
/* translators: %s: number of carts */
'yes' => sprintf(__('Can contact · %s', 'ai-flash-tune'), number_format_i18n((int) ($aiflt_counts['with_email'] ?? 0))),
/* translators: %s: number of carts */
'no' => sprintf(__('No contact · %s', 'ai-flash-tune'), number_format_i18n((int) ($aiflt_counts['without_email'] ?? 0))),
];
$aiflt_contact_keep = ['page' => 'aiflt-abandoned-carts', 'customer_type' => $aiflt_customer_type] + $aiflt_period_args;
echo AIFLT_UI::segmented($aiflt_contact_options, $aiflt_contact, 'contact', $aiflt_contact_keep, __('Contact', 'ai-flash-tune')); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped inside.
?>
1) :
$aiflt_page_base = add_query_arg($aiflt_keep + $aiflt_period_args, admin_url('admin.php'));
?>
|
|
|
|
| ' . esc_html($aiflt_product['name']) . '';
} else {
echo esc_html($aiflt_product['name']);
}
?> |
|
|
|