I'm trying to get the product category to display on the cart and checkout pages for each product added.
My php knowledge is very limited so the most dumbed down explanation would be great :)
I've had a look at the woocommerce docs and googled for the genesis connect docs but I didnt find what I was looking for.
Using Genesis Woocommerce Connect and the latest woocommerce and wordpress.
Not sure where to go from here.. :/
the woocommerce>templates>cart>cart.php is the cart page.In this,foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item )
loop display the products you added to the cart.Variable $product_id
of the loop have the id of each product you added the the cart.
Put this code inside the loop
$terms = get_the_terms( $product_id, 'product_cat' );
foreach ($terms as $term) {
$product_cat = $term->name;
}
echo $product_cat ;
It will display the categories. Work out and let me know:)