The Social Checkout for WooCommerce plugin lets you create sharing links for the items in a customer’s cart. Sometimes you might want to exclude specific products from this list.

The plugin includes filters that let you override the list of items to be shown. Here’s a sample that excludes product ID 411 from being shown – obviously you can code up whatever logic you need.

function lw_woo_sc_order_line_items( $items, $order ) {
    foreach ( $items as $key => $item ) {
        if ( $key == 411 ) {
            unset( $items[ $key ] );
        }
    }
    return $items;
}
add_filter( 'woo_sc_order_line_items', 'lw_woo_sc_order_line_items', 10, 2 );

This entry was posted in .
Bookmark the permalink.