add_filter("wpslash_tipping_enabled_filter", "wpslash_tipping_enabled_filter");
function wpslash_tipping_enabled_filter($bool)
{
global $woocommerce;
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
$product = $cart_item['data'];
$product_id = $cart_item['product_id'];
$quantity = $cart_item['quantity'];
$price = WC()->cart->get_product_price( $product );
$subtotal = WC()->cart->get_product_subtotal( $product, $cart_item['quantity'] );
$link = $product->get_permalink( $cart_item );
// Anything related to $product, check $product tutorial
$meta = wc_get_formatted_cart_item_data( $cart_item );
if ($product->is_virtual('yes')) {
return true;
}
}
return false;
}