Home › Forums › Front-end Issues › Show ACF field in WooCommerce Archive Listing › Reply To: Show ACF field in WooCommerce Archive Listing
WooCommerce has _a literal ton_ of hooks to use. If you open up the plugin folder ( plugins/woocommerce/templates ) you can open up those files and see just how many you can hook into.
The one you’re looking for is in the content-single-product.php
file:
/**
* Display value after single product titles
*
* @return void
*/
function prefix_after_title() {
echo get_field( 'after_title' );
}
add_action( 'woocommerce_single_product_summary', 'prefix_after_title', 6 );
We need the priority of 6 because the file linked above shows that the title is prioritized at 5. If we wanted to display this before the title we would need to change the priority to something before 5.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.