This topic has 3 replies, 2 voices, and was last updated 2 months, 3 weeks ago ago by Andrew Mitchell
Hello, I want to use this code to include a custom field on the product archive loop, but its not showing up on the xstore loops, only the elementor loops. Is there any way to alter the code so that it can show up on the xstore loop?
add_action( ‘woocommerce_after_shop_loop_item_title’, ‘pedro_add_acf_field_to_product_loop’, 15 );
function pedro_add_acf_field_to_product_loop() {
global $product;
// Get the product ID
$product_id = $product->get_id();
// Get the ACF field value
$product_highlight = get_field( ‘product_highlight’, $product_id );
// Check if the ACF field value exists and display it
if ( ! empty( $product_highlight ) ) {
echo ‘<div class=”product-highlight”>’ . esc_html( $product_highlight ) . ‘</div>’;
}
}
code is from this website: https://puri.io/blog/how-to-add-acf-fields-to-the-woocommerce-product-loop/
Thanks so much for your help
Info in private area
Dear carliczyk,
We trust our theme is enhancing your experience. Taking a brief moment to rate it with a glowing 5 stars on ThemeForest would be immensely appreciated. Your feedback holds significant value for us.
Click here to rate now: https://themeforest.net/downloads
Thank you sincerely for your ongoing support!
Best Regards,
The 8Theme Team
The issue related to '‘Add Advanced Custom Field to Archive Product Loop’' has been successfully resolved, and the topic is now closed for further responses