Support

Account

Home Forums General Issues Display price in ACF object field

Unread

Display price in ACF object field

  • Hello,

    I’m using the ‘Post object’ feature from ACF in order to show Woocommerce products in my website. I’m using the code below and I managed to show the title and content of the product, but can’t find the way to show the price of the product.

    <?php
                                    $featured_post = get_sub_field('product');
                                    $price = get_post_meta( get_the_ID(), ‘_regular_price’, true);
                                    if ($featured_post): ?>
    
    										<img src="<?php echo get_the_post_thumbnail_url($featured_post, 'url'); ?>">
                        <span class="full-product_title">SHOP</span>
                        <div class="full-product_desc">
    										   <h3><?php echo esc_html($featured_post->post_title); ?></h3>
                           <p><?php echo wpautop($featured_post->post_content); ?></p>
                        </div>
                        <?php endif ?>

    How should I do that?
    Thanks

Viewing 1 post (of 1 total)

The topic ‘Display price in ACF object field’ is closed to new replies.