Skip to main content

Filters

Tracking​

FilterParametersReturns
phplugins_live_carts_should_create_cart$should, $cartbool. 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, $userIdbool. 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$ipThe IP address to store.
phplugins_live_carts_track_revisions$track, $cartIdbool. Whether to record a revision.
phplugins_live_carts_max_carts_with_revisions$maxHow many carts keep history. Default 100.
phplugins_live_carts_email_field_selector$selectorThe 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​

FilterReturnsDefault
phplugins_live_carts_abandon_timeSeconds of inactivity before a cart is abandoned.7200 (2 hours)
phplugins_live_carts_archive_timeSeconds of inactivity before a cart is archived.2592000 (30 days)

Frontend​

FilterParametersReturns
phplugins_live_carts_frontend_cart_id_html$html, $cartIdThe markup that displays the cart ID.

Admin​

FilterParametersReturns
phplugins_live_carts_admin_cart_contents$html (null), $cartData, $contentsHTML 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], $viewTypeThe [$sql, $params] pair that filters the cart list query.
phplugins_live_carts_list_context_query_args$args, $viewTypeQuery arguments carried across list views.
phplugins_live_carts_status_checks$checksThe checks array of the Status page. Add your own.
live_carts_for_woocommerce_admin_page_class$classThe admin page class name. Pro extends it.

Recovery emails​

FilterParametersReturns
phplugins_live_carts_should_send_recovery_email$should, $cart, $emailPostbool. Return false to skip this email for this cart.
phplugins_live_carts_recovery_email_shortcodes$shortcodesArray of code => description, shown in the editor.
phplugins_live_carts_recovery_email_shortcode_replacements$replacements, $cart, $emailPostArray of '[code]' => value.
phplugins_live_carts_recovery_email_to$to, $cart, $emailPostThe recipient.
phplugins_live_carts_recovery_email_subject$subject, $cart, $emailPostThe subject, after shortcodes are replaced.
phplugins_live_carts_recovery_email_body$body, $cart, $emailPostThe body HTML, after shortcodes are replaced.
phplugins_live_carts_recovery_email_headers$headers, $cart, $emailPostThe headers array.
phplugins_live_carts_recovery_email_cart_contents_html$html, $cartContentsThe HTML behind [cart_contents].
phplugins_live_carts_recovery_email_item_html$html, $item, $productThe 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.

  • REST API: read, and with Pro update, carts and shopper lists over HTTP.
  • Webhooks: get a signed JSON request at your own URL when a cart or shopper list changes.
  • Actions: PHP action hooks fired by Live Carts.