Support

Account

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>'
     ;}