Home › Forums › Front-end Issues › Show ACF field in WooCommerce Archive Listing › Reply To: Show ACF field in WooCommerce Archive Listing
Hi i want to do something similar. I have a acf input field called “contado_en_local” and i want to replace the woocommerce regular price with it in the archive product page.
The problem is that the acf field appears, but above the title and i want it below, and also it didn’t removed the woocommerce default regular price.
Also i don’t how to style it. It is donde in the child-theme’s style.css?
I made a custom plugin called WOOCOMMERCE ALE BIANCHI and insert this code in wp-content/plugins/woocommerce-ale-bianchi-audioarte.
<?php
/*
Plugin Name: WOOCOMMERCE ALE BIANCHI
Plugin URI: https://rampcrosario.com
Description: Funciones personalizadas Woocommerce para AudioArte
Version: 1.0.0
Author: ALE BIANCHI
Author URI: https://rampcrosario.com
License: GPL 2+
License URI: https://rampcrosario.com
*/
//* Mostrar precio CONTADO creado con ACF en vez de DEBITO colocado en precio regular Woocommerce
add_action( 'after_setup_theme', 'ale_custom_shop_woocommmerce' );
function ale_custom_shop_woocommmerce () {
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
function ale_acf_precio() {
if(get_field('contado_en_local'))
{
echo '<p>' . get_field('contado_en_local') . '</p>';
}
}
add_filter( 'woocommerce_after_shop_loop_item_title', 'ale_acf_precio', 15 );
}
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.