HTML Showing In Cart
-
Can you make it so your cart renders html from a filter function (below)? I have a filter that adds the sku# to the product name in the cart, but in the Caddy popout it shows as the raw html.
add_filter( ‘woocommerce_cart_item_name’, ‘showing_sku_in_cart_items’, 99, 3 );
function showing_sku_in_cart_items( $item_name, $cart_item, $cart_item_key ) {
// The WC_Product object
$product = $cart_item[‘data’];
// Get the SKU
$sku = $product->get_sku();// When sku doesn’t exist
if(empty($sku)) return $item_name;// Add the sku
$item_name .= ‘<br><small class=”product-sku”>’ . __( “Style #”, “woocommerce”) . $sku . ‘</small>’;return $item_name;
}
- The topic ‘HTML Showing In Cart’ is closed to new replies.