Support

Account

Home Forums ACF PRO Display Custom Field on Product Category Page

Solving

Display Custom Field on Product Category Page

  • I added a custom field to the product category page. It’s a Wyswig field. I can’t seem to figure out how to display the field on the page.

    I’ve edited the product-archive.php file and placed the following code before the woocommerce_product_loop_end(); hook

    $value = get_field( 'bottom_description', 8 );
    	echo $value;

    I’ve also tried adding a hook in the functions.php file.

    add_action( 'woocommerce_after_shop_loop', 'prodcatdesc' );
        function prodcatdesc() {
            echo the_field('bottom_description');
        }

    How can I get this to work?

  • Did you get this to work? If so how??

  • What does 8 represent here $value = get_field( 'bottom_description', 8 );

    If you want to get a field from a category

    
    $queried_object = get_queried_object();
    $value = get_field('field-name', $queried_object);
    
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.