Home Forums Front-end Issues Product as post object doesn't show its own title


Product as post object doesn't show its own title

  • Hello
    I just saw an issue on my website.

    I ‘ve built a repeater field with a subfield “post object” set on product in my ACF panel in order to let editors add 1 or more product links of their choice into a product page (a kind of related products function)
    All looks good, thumbnails are well loaded
    But title and hyperlink of the “related” products are the same than title and permalink of the current product page

    here is my code, base on the related product loop code :

    <?php woocommerce_product_loop_start(); ?>
    		<?php while( have_rows('add_author_product') ): the_row(); 
    			$mayLikeProducts = get_sub_field('author_procuct_choice');
    			if( $mayLikeProducts ): 
    				$post_object = $mayLikeProducts;
    				setup_postdata( $post_object ); 
    				<?php wc_get_template_part( 'content', 'product' ); ?>
    			    <?php wp_reset_postdata(); ?>
    			<?php endif; ?>
    		<?php endwhile; ?>
    		<?php woocommerce_product_loop_end(); ?>

    thanks for your time & help

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.