How to add ACF field on products archive page ?

This topic has 2 replies, 2 voices, and was last updated 2 weeks, 2 days ago ago by Luca Rossi

  • Avatar: Mario
    Mario
    Participant
    November 7, 2024 at 16:35

    Hello,
    I would like to add a ACF Field for the Date like this on the archive products page. The ACF field is already on the page product. How can I add this on the archive ?

    Files is visible for topic creator and
    support staff only.
    1 Answer
    Avatar: Justin
    Luca Rossi
    Support staff
    November 8, 2024 at 06:05

    Hi @Mario,

    Please try adding this custom codes under functions.php file locates in your child theme:

    
    function woocommerce_template_loop_product_title() {
    	echo '<h2 class="' . esc_attr( apply_filters( 'woocommerce_product_loop_title_classes', 'woocommerce-loop-product__title' ) ) . '">' . get_the_title() . '</h2>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    	the_field('your_field_name');
    }
    

    The custom field will display under your product titles.

    Hope it helps!

  • Viewing 2 results - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service

Helpful Topics

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.