I guess this never got replied to then? Looks like separate fields is the way to go!
Add this filter to the functions.php file in your child theme:
add_filter( 'acf/format_value/name=your_acf_field_name', 'format_number_as_currency', 20, 3 );
function format_number_as_currency( $value, $post_id, $field ){
if($value > 0) :
$value = '$' . number_format(($value), 0, '.', ',');
endif;
return $value;
}
Change your_acf_field_name
part of the filter hook to the name of your ACF field.
You can also change the currency symbol used in $value – e.g. £
for GBP, or €
for EUR
Hope that helps…
Does anyone know why this would no longer work in Woocommerce 3.0.x?
All tabs in wp-admin no longer show & ‘visual’ tab for text editor no longer works! Does anyone from support ever read these forums?
Hmm, it seems that this doesn’t work properly with Woocommerce 3.0.x – the fields still show on the front-end, but the admin GUI is all messed up! 🙁
I have done this very thing for a client (but for different reasons)…
Here’s the code I used to display a WYSIWYG custom field in the attributes list:
add_filter( 'woocommerce_get_product_attributes', 'ariel_display_recordings_attribute', 20 );
function ariel_display_recordings_attribute( $attributes ) {
$ariel_recording_details = get_field('ariel_recording_details');
if (!empty(get_field('ariel_recording_details'))) {
$attribute = array(
'name' => 'Recording',
'value' => $ariel_recording_details,
'is_visible' => '1',
'is_taxonomy' => '0',
'is_variation' => '0',
'position' => '0',
);
$attributes['ariel_recording_details'] = $attribute;
}
return $attributes;
}
You can also add additional code to attributes.php to specify what order you’d like attributes to appear in…
Ignore my last post, I should RTFM!!!! 😉
Is it possible to restrict which countries the search field returns results for? I know this is possible using the suggest/autocomplete google API but a pointer to any hooks/filters in ACF PRo for this would be helpful…
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.