Skip to content

Instantly share code, notes, and snippets.

@imran-khan1
Last active September 6, 2019 06:36
Show Gist options
  • Save imran-khan1/e30ed3f19c2e8eeb1c45ade1124e73b9 to your computer and use it in GitHub Desktop.
Save imran-khan1/e30ed3f19c2e8eeb1c45ade1124e73b9 to your computer and use it in GitHub Desktop.
<?php
//display data in cart item table
function display_data_in_cart_item_table( $product_name, $cart_item, $cart_item_key ) {
$categories = wc_get_product_category_list( $cart_item['product_id']);
$product_sku = get_post_meta($cart_item['product_id'] , '_sku', true);
$product_name = $product_name . '<dl style="border:2px solid red;padding:10px;">
<dt>Category : </dt>
<dd class=""><p>'. $categories .'</p></dd>
<br/>
<dt>Sku : </dt>
<dd><p>'. $product_sku .'</p></dd></dl>
';
return $product_name;
}
add_filter( 'woocommerce_cart_item_name', 'display_data_in_cart_item_table', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment