Home › Forums › General Issues › Post type = product per single product › Reply To: Post type = product per single product
Hi Jhon,
appreciate the reply! The code above is coming from woocommerce/content-single-product.php
Basically there is an ACF field called featured_products that is displayed on the each product page while creating/editing a product. This would be so we can select what products we want to feature for the current product.
With your help I have resolved the issue in the code previous developer had done.
I amended the code and left out the following:
<!-- php
$meta_query = WC()->query->get_meta_query();
$tax_query = WC()->query->get_tax_query();
$tax_query[] = array(
'taxonomy' => 'product_visibility',
'field' => 'name',
'terms' => 'featured',
'operator' => 'IN',
);
$args = array(
'post_type' => 'product',
'post_status' => 'publish',
'orderby' => 'post_date',
'order' => 'DSC',
'posts_per_page' => 4,
'meta_query' => $meta_query,
'tax_query' => $tax_query,
);
-->
Then edited the code below this to reflect
<?php
$post_objects = get_field( 'featured_products' );
if( $post_objects ): ?>
while adjusting the code within the divs.
THANK YOU SO MUCH! I would never have gotten this without your suggestion (and some heavy reading in the documentation!)
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.