Filters
Tracking
| Filter | Parameters | Returns |
|---|---|---|
phplugins_live_carts_should_create_cart | $should, $cart | bool. Return false to skip tracking this cart. By default carts are tracked when they're not empty and not already converted. |
phplugins_live_carts_should_create_list | $should, $type, $userId | bool. Same, for Shopper Lists. |
phplugins_live_carts_cart_insert | [$data, $formats] | The data and formats passed to $wpdb->insert() when a cart is created. Pro adds session_key. |
phplugins_live_carts_cart_ip_address | $ip | The IP address to store. |
phplugins_live_carts_track_revisions | $track, $cartId | bool. Whether to record a revision. |
phplugins_live_carts_max_carts_with_revisions | $max | How many carts keep history. Default 100. |
phplugins_live_carts_email_field_selector | $selector | The CSS selector of the checkout email field that is watched. |
// Don't track carts that contain only free products.
add_filter( 'phplugins_live_carts_should_create_cart', function ( $should, $cart ) {
return $should && $cart->get_total( 'edit' ) > 0;
}, 10, 2 );
Timing
| Filter | Returns | Default |
|---|---|---|
phplugins_live_carts_abandon_time | Seconds of inactivity before a cart is abandoned. | 7200 (2 hours) |
phplugins_live_carts_archive_time | Seconds of inactivity before a cart is archived. | 2592000 (30 days) |
Frontend
| Filter | Parameters | Returns |
|---|---|---|
phplugins_live_carts_frontend_cart_id_html | $html, $cartId | The markup that displays the cart ID. |
Admin
| Filter | Parameters | Returns |
|---|---|---|
phplugins_live_carts_admin_cart_contents | $html (null), $cartData, $contents | HTML to replace the cart contents table, or null to keep the default. Pro uses it for the cart editor. |
phplugins_live_carts_list_filter_sql | [$sql, $params], $viewType | The [$sql, $params] pair that filters the cart list query. |
phplugins_live_carts_list_context_query_args | $args, $viewType | Query arguments carried across list views. |
phplugins_live_carts_status_checks | $checks | The checks array of the Status page. Add your own. |
live_carts_for_woocommerce_admin_page_class | $class | The admin page class name. Pro extends it. |
Recovery emails
| Filter | Parameters | Returns |
|---|---|---|
phplugins_live_carts_should_send_recovery_email | $should, $cart, $emailPost | bool. Return false to skip this email for this cart. |
phplugins_live_carts_recovery_email_shortcodes | $shortcodes | Array of code => description, shown in the editor. |
phplugins_live_carts_recovery_email_shortcode_replacements | $replacements, $cart, $emailPost | Array of '[code]' => value. |
phplugins_live_carts_recovery_email_to | $to, $cart, $emailPost | The recipient. |
phplugins_live_carts_recovery_email_subject | $subject, $cart, $emailPost | The subject, after shortcodes are replaced. |
phplugins_live_carts_recovery_email_body | $body, $cart, $emailPost | The body HTML, after shortcodes are replaced. |
phplugins_live_carts_recovery_email_headers | $headers, $cart, $emailPost | The headers array. |
phplugins_live_carts_recovery_email_cart_contents_html | $html, $cartContents | The HTML behind [cart_contents]. |
phplugins_live_carts_recovery_email_item_html | $html, $item, $product | The HTML of one product line in [cart_contents]. |
Add your own shortcode
add_filter( 'phplugins_live_carts_recovery_email_shortcodes', function ( $codes ) {
$codes['store_name'] = 'Your store name';
return $codes;
} );
add_filter( 'phplugins_live_carts_recovery_email_shortcode_replacements', function ( $replacements ) {
$replacements['[store_name]'] = get_bloginfo( 'name' );
return $replacements;
} );
Renamed filter
The replacements filter was previously documented as phplugins_live_carts_recovery_email_replacements. The current name is phplugins_live_carts_recovery_email_shortcode_replacements.