Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #659230

    Hi there,

    I’ve used the code found here: https://kriesi.at/support/topic/display-product-category-under-title/#post-182523
    to display woocommerce product category under title. Is there a way to display it over the title = between the product image and product title?

    Best regards

    Carsten

    #659382

    Hey mariajoensen,

    Would you mind providing a precise link to your site, showing the elements in question? We need to be able to inspect them in order to help :)

    Best regards,
    Andy

    #659805

    HI Andy,

    The site is not open yet. I’ve sent you login credentials in the Private Content. It is the shop page: http://www.dropsbysamira.com/shop/

    Regards
    Carsten

    #660663

    Hi,

    Please replace the code with the following:

    add_action( 'woocommerce_before_shop_loop_item_title', 'avia_add_product_cat', 20);
    function avia_add_product_cat()
    {
        global $product;
        $product_cats = wp_get_post_terms($product->id, 'product_cat');
        $count = count($product_cats);
        foreach($product_cats as $key => $cat)
        {
            echo $cat->name;
            if($key < ($count-1))
            {
                echo ', ';
            }
            else
            {
                echo '
    ';
            }
        }
    }
    

    We used the “woocommerce_before_shop_loop_item_title” instead of the “woocommerce_after_shop_loop_item_title” action hook.

    Best regards,
    Ismael

    #661204

    That worked.

    Thanx Ismael!

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Product category between image and title’ is closed to new replies.