Side Cart exposes one action and three filters for theme and plugin authors.
side_cart_trigger_selectors
Tells Side Cart which existing element(s) on the page should open the drawer, when the trigger mode is set to use your theme’s own cart icon instead of Side Cart’s built-in one.
add_filter( 'side_cart_trigger_selectors', function ( $selectors ) {
$selectors[] = '.my-theme-cart-icon';
return $selectors;
} );
The default selectors are .cart-contents and any link whose address contains /cart/.
sc_after_cart_item_name
An action that fires right after each line’s product name in the drawer — the drawer’s counterpart of WooCommerce’s woocommerce_after_cart_item_name. It receives the cart item array and its cart item key. Use it to print a short note under the name; Progressive Discount uses it for its “Not included (sale item)” label.
add_action( 'sc_after_cart_item_name', function ( $cart_item, $cart_item_key ) {
if ( $cart_item['data']->is_on_backorder( $cart_item['quantity'] ) ) {
echo '<span class="my-backorder-note">' . esc_html__( 'Ships in 2 weeks', 'my-theme' ) . '</span>';
}
}, 10, 2 );
sc_cart_item_locked
Return true to show a cart line without its quantity stepper and remove button. Side Cart also refuses quantity changes and removals for that line from the drawer, and leaves it out of the savings shown in the drawer. It receives the current value (false by default), the cart item array and its cart item key. Progressive Discount and Smart Cross Sell use it for their free gift lines.
add_filter( 'sc_cart_item_locked', function ( $locked, $cart_item, $cart_item_key ) {
return ! empty( $cart_item['my_free_gift'] ) ? true : $locked;
}, 10, 3 );
sc_cart_savings_summary_html
Filters the “You save … on this order” line shown under the Total. It receives the escaped HTML and the amount saved as a number.
add_filter( 'sc_cart_savings_summary_html', function ( $html, $amount ) {
return sprintf( esc_html__( 'Today you save %s', 'my-theme' ), wc_price( $amount ) );
}, 10, 2 );