Home › Forums › General Issues › How do I echo ACF custom fields for a WooCommerce product listing? › Reply To: How do I echo ACF custom fields for a WooCommerce product listing?
In case anybody was wondering, I’ve managed to fix it. Turns out it was because I was trying to echo PHP through PHP. I’ve updated the code to the following and it’s working.
add_action( 'woocommerce_single_product_summary', 'ngt_accordion', 11 );
function ngt_accordion() {
echo '<div id="ngt-accordion">
<ul class="nav">
<li><a href="#">Aviator\'s Notes</a>
<ul>
<li>';
the_field("aviators_notes");
echo '</li>
</ul>
</li>
<li><a href="#">Product Overview</a>
<ul>
<li>';
the_field("product_overview");
echo '</li>
</ul>
</li>
<li><a href="#">Size & Details</a>
<ul>
<li>';
the_field("size_and_details");
echo '</li>
</ul>
</li>
<li><a href="#">Care Instructions</a>
<ul>
<li>';
the_field("care_instructions");
echo '</li>
</ul>
</li>
<li><a href="#">Delivery & Returns</a>
<ul>
<li>';
the_field("delivery_and_returns");
echo '</li>
</ul>
</li>
</ul>
</div>'
;}
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.