Support

Account

Home Forums ACF PRO Unable to return custom field in woocommerce shop subcategories

Unread

Unable to return custom field in woocommerce shop subcategories

  • I am trying to echo a custom field ‘course_short_desc’ underneath the title of each woocommerce subcategory on the parent category page (which lists all the shop subcategories).

    Have spent a whole day on this without success. The closest I have got is the following code…

    add_action( 'woocommerce_after_subcategory_title', 'display_short_course_info', 35 );  
    
    function display_short_course_info() {
        $term_object = get_queried_object();
        echo the_field('course_short_desc', 'product_cat_'.$term_object->term_id);
    }

    This code does echo out ‘course_short_desc’ value but for the parent category, not the shop subcategory itself. I know I need to hook into the sub-category’s field somehow but nothing I have tried has worked. Any help much appreciated, thanks.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.