I have a new registration form for WooCommerce which contains an email address field in the correct place I want it to appear in the new form.
However WooCommerce seems to add its own email address field below by own new form.
Is there a way to disable the original field and simply use the new one that I created in the ACF form?
I want to create personalized gifts offered to customers based on the amount they have when completing an order, is this possible using ACF Pro and if something similar has been used before
Thank you
I use ACF prugin for WooCommerce child theme
I try to create fields for yourtheme/woocommerce/content-product.php page.
I need to show image with text for product listing and categories
So I created Shop Field Group – Shop page image and text
For Shop image:
field type = image
field name = shop_page_image
return format = image url
library = all
Location rules
Show this field group if
page is equal to Shop ( I have page for WooCommerce shop page in backend )
or
page is equal to Home ( add it for testing )
I can add image to Shop page and Home using WordPress edit page
And if I try to show image using this
<?php $shop_image = get_field('shop_page_image');
var_dump($shop_image);
?>
or
<?php
$image = get_field('shop_page_image');
if( !empty($image) ): ?>
<img src="<?php echo esc_url($image['url']); ?>" alt="<?php echo esc_attr($image['alt']); ?>" />
<?php endif; ?>
I get NULL for Shop page but I get image url for Home page. How to get field on Shop page too?
I have child theme and WooCommerce folder in child theme has 2 files – archive-product.php and content-product.php
Hi community 👋
I have an ACF Field Group for WooCommerce Products that is used to show information on the product page. This ACF Field Group has the Show in REST API enabled.
However, when I access it through the API, I can’t see anything from ACF.
https://domain.com/wp-json/wc/v3/products/3644
Is there anything I’m doing wrong, is there any workaround or something I can do? The information there is very important.
Really thank you! 😊
Hi
I have setup an ACF field group with multiple fields (Text and Taxonomy). I want to show the value of a field in the product (WooCommerce).
With the text fields, it works like this:
get_field('myfield')
But with the taxonomy fields, I just get the ID of the attribute.
How can I display the value set in the product on this attribute instead of the ID?
Hello to all forum members, I am hoping you can please help me, I have only recently started to use ACF to add content to my woocommerce single product template which works well when I import new products using csv import, I am currently using the free version (but obviously planning to upgrade!).
We are now trying to add new products by automation using api, when importing we get the system fields populated but none of the ACF fields data is added and we receive an error?
This is the error we receive:
{“code”:”rest_invalid_param”,”message”:”Invalid parameter(s): meta_data”,”data”:{“status”:400,”params”:{“meta_data”:”meta_data[0] is not of type object.”},”details”:{“meta_data”:{“code”:”rest_invalid_type”,”message”:”meta_data[0] is not of type object.”,”data”:{“param”:”meta_data[0]”}}}}}
If we create products without meta_data fields (ACF Fields), then It seems to perfectly create a new product.
I have also added here an attachment, I attach the error screenshot.
Many thanks for any help or guidance, we look forward to hearing from you.
Hello to all forum members, I am hoping you can please help me, I have only recently started to use ACF to add content to my woocommerce single product template which works well when I import new products using csv import, I am currently using the free version (but obviously planning to upgrade!).
We are now trying to add new products by automation using api, when importing we get the system fields populated but none of the ACF fields data is added and we receive an error?
This is the error we receive:
{“code”:”rest_invalid_param”,”message”:”Invalid parameter(s): meta_data”,”data”:{“status”:400,”params”:{“meta_data”:”meta_data[0] is not of type object.”},”details”:{“meta_data”:{“code”:”rest_invalid_type”,”message”:”meta_data[0] is not of type object.”,”data”:{“param”:”meta_data[0]”}}}}}
If we create products without meta_data fields (ACF Fields), then It seems to perfectly create a new product.
I have also added here an attachment, I attach the error screenshot.
Many thanks for any help or guidance, we look forward to hearing from you.
Hi,
In our WooCommmerce store we have a custom taxonomy called Brand. Under the Brand taxonomy there is an ACF field called Shipping Time.
I would like to create another Shipping Timem ACF for WooCommerce products and populate it’s default value from the assigned brands Shipping Time ACF field.
Is that somehow possible?
Hi All 🙂
I am a beginner to this and am after adding the values of some of the fields I have created for Woocommerce products on the front end in a custom information tab.
I have created the addition info tab in the functions.php file.
Now, to get the info I need into this tab.
I can show a field in the field set by using the following
echo the_field('location');
But, I want to do these as
So, how to I insert html into the echo?
Like
echo '<li>Location Title : the_field('location')</li>';
So, on the front end would be
trying all sorts here and dont have the time to go back to school and learn the basics of PHP LOL
Cheers
Hello,
I’m hoping to get my hands on a custom query that will show only WooCommerce products in a category that are assigned to a User using the ACF User field.
For instance, there is a Product category named “Category X,” and in the User custom field that appears on its Product category settings page, I selected “User X,” creating a relationship between the “Category X” and “User X.”
Now I need a query to show only the products (in “Category X”) for “User X” when they are logged in. This query needs to work for any particular user (I will be assigning different product categories to different users).
I’m trying to use Dynamic.ooo to set this query, but unfortunately the options don’t allow it, so it must be custom.
Preferred Query ID: user_category
ACF Settings:
Field Type: User
Field name: category_user
Filter By Role: Customer
Return Format: User Array (or whatever works best)
Show this field group if: Taxonomy is equal to Category (product_cat)
I tried the below but it is not working:
$args = array(
'posts_per_page' => -1,
'post_type' => 'product',
'taxonomy' => 'product_cat',
//Tries to show products from categories where current user ID is the same as the category_user field
'meta_query' => array(
array(
'key' => 'category_user',
'value' => $current_user->ID,
'compare' => 'LIKE'
)
)
);
Hello,
I’m an ACF pro customer and I’m hoping to get my hands on a custom query that will show only WooCommerce products in a category that are assigned to a User using the ACF User field.
For instance, there is a Product category named “Category X,” and in the User custom field that appears on its Product category settings page, I selected “User X,” creating a relationship between the “Category X” and “User X.”
Now I need a query to show only the products (“Category X) for “User X” when they are logged in. This query needs to work for any particular user (I will be assigning different product categories to different users).
I’m trying to use Dynamic.ooo to set this query, but unfortunately the options don’t allow it, so it must be custom.
Preferred Query ID: user_category
ACF Settings:
Field Type: User
Filter By Role: Customer
Return Format: User Array (or whatever works best)
Show this field group if: Taxonomy is equal to Category (product_cat)
Hi
I have a similar problem as described here.
Wordpress 6.1.1 – latest
ACF Pro 6.0.7 – latest
WooCommerce 7.4.1 – latest
WPML Multilingual CMS 4.5.14 – latest
I have an options-page where I can set a featured prodct and some selected bestsellers. This fields are done with ACF Post Object for the featured product and with ACF Relationship for the bestsellers.
Main problem is, that my page is multilingual but not the products. the products are in german only. For this I have set the “Post Type Translation” in WPML for the Post-Type product to “Translatable – use translation if availlable or fallback to default language”. With this setting I can reach my products in all languages even though thea are not translated.
Now on my options-page I can select products on my default language (german).
When I change to another language (En and Fr) there ist a message that says “No matches found” and I am not able to choose products for that Post Type.
What am I missing?
Does anyone has an idea where to search and what I can try to select products made in another language?
best regards
roman
Hello,
Is it possible to set an ACF field for a WooCommerce Shipping zone? If possible, how can I achieve that?
Kind regards,
I have ACF Fields setup for Post Type while using WooCommerce. Each single Product has unique ACF Fields such as {“location”} value and {“brochure”} value.
I would like to use WPForms’Dynamic Post Type Source’ to create a dropdown list that autopopulates dynamic choices based on the values of these ACF Fields, And ideally only for Products that are In-Stock to reduce size of dropdown list.
DROPDOWN LIST:
Location 1 – Brochure URL
Location 2 – Brochure URL
Location 3 – Brochure URL
Location 4 – Brochure URL
etc
I understand within Advanced settings, Dynamic Choices can be selected for Post Type or Taxomny, but I’m not sure how this can be achieved with ACF Field Values.
The only workaround I have found so far is by adding custom WordPress taxonomy that is only related to products. It would act and show just like categories and tags do and show up on the Products page, which would allow the ability to select it from the Dynamic Choices inside WPForms. However, the major limitation here is that I would need to add the taxonomy to every single existing product, and it doesn’t consider stock status.
function add_custom_taxonomies() {
// Add new "Locations" taxonomy to Posts
register_taxonomy('location', 'product', array(
// Hierarchical taxonomy (like categories)
'hierarchical' => true,
// This array of options controls the labels displayed in the WordPress Admin UI
'labels' => array(
'name' => _x( 'Locations', 'taxonomy general name' ),
'singular_name' => _x( 'Location', 'taxonomy singular name' ),
'search_items' => __( 'Search Locations' ),
'all_items' => __( 'All Locations' ),
'parent_item' => __( 'Parent Location' ),
'parent_item_colon' => __( 'Parent Location:' ),
'edit_item' => __( 'Edit Location' ),
'update_item' => __( 'Update Location' ),
'add_new_item' => __( 'Add New Location' ),
'new_item_name' => __( 'New Location Name' ),
'menu_name' => __( 'Locations' ),
),
// Control the slugs used for this taxonomy
'rewrite' => array(
'slug' => 'locations', // This controls the base slug that will display before each term
'with_front' => false, // Don't display the category base before "/locations/"
'hierarchical' => true // This will allow URL's like "/locations/boston/cambridge/"
),
));
}
add_action( 'init', 'add_custom_taxonomies', 0 );
Hello,
i have created products and product categories with ACF. I dont use Woocommerce and build it with acf fields.
I use Breakdance Builder and want to query all products per specific category. So i created a template for my product archives but it shows all products from all product categories and not the specific iam on, like sneakers.
I can insert a query which is atm.
return [‘post_type’ => ‘products’];
Can you please help me how i can query products by category.
best regards
Hey all,
So, I have a repeater field which my site users will be able to use on the frontend using acf_form()
to add rows to the repeater. This form appears on a WooCommerce order details page
Form works fine, rows get added etc and saved to the order. Cool.
Now, one of the fields in the repeater is an email address. Here’s what I’m hoping I can get to happen:
acf_form()
This action needs to be triggered EVERY TIME the form is changed and submitted on the frontend
Hopefully this is possible
Here’s kind of what I have from another support post I stumbled on from Google:
function delegate_form_update($value, $post_id, $field) {
// only do it to certain custom fields
if($field['name'] == 'ticket_alloc') { // ticket_alloc is the name of the repeater
// get the old (saved) value
$old_value = get_field('ticket_alloc', $post_id);
// get the new (posted) value
$new_value = $_POST['acf']['field_63ca95e88557a']; // this is the key of the repeater
// check if the old value is the same as the new value
if($old_value != $new_value) {
// Do something if they are different
} else {
// Do something if they are the same
}
}
// don't forget to return to be saved in the database
return $value;
}
add_filter('acf/update_value', 'delegate_form_update', 10, 3);
Can anyone help, or point me in the right direction? @hube2 @acf-support ?
Thanks
Mark
Hey all,
So, I have a repeater field which my site users will be able to use on the frontend using acf_form()
to add rows to the repeater. This just happens to be a WooCommerce order, but I don’t think that’s relevant
Form works fine, rows get added etc and saved to the order. Cool.
Now, one of the fields in the repeater is an email address. Here’s what I’m hoping I can get to happen:
acf_form()
This action needs to be triggered EVERY TIME the form is changed and submitted on the frontend
Hopefully this is possible
Here’s kind of what I have from another support post I stumbled on from Google:
function delegate_form_update($value, $post_id, $field) {
// only do it to certain custom fields
if($field['name'] == 'ticket_alloc') { // ticket_alloc is the name of the repeater
// get the old (saved) value
$old_value = get_field('ticket_alloc', $post_id);
// get the new (posted) value
$new_value = $_POST['acf']['field_63ca95e88557a']; // this is the key of the repeater
// check if the old value is the same as the new value
if($old_value != $new_value) {
// Do something if they are different
} else {
// Do something if they are the same
}
}
// don't forget to return to be saved in the database
return $value;
}
add_filter('acf/update_value', 'delegate_form_update', 10, 3);
Can anyone help, or point me in the right direction? @hube2 @acf-support ?
Thanks
Mark
Hi guys, I hope I am writing in the correct section.
I have a client’s site in wordpress + learndash + woocommerce (learndash integrated with woocommerce), in the course section of learndash there are some fields in ACF, my question is, how can I bring the value of an ACF field from the course section, in the checkout?
That field that I need to bring in is a date field (name given by the client: “expire course”), it is the expiration of the course that needs to be present in the checkout as it will need to be present in the API (woocommerce API + active campaign) as I will be going to create reminder notifications with active campaign with this date.
I hope I explained myself well, thanks in advance!
Dear ACF Community,
I need some help with the ACF Extended Color Palette field. I added a Color Palette field to my woocommerce products, so any product can have a unique border color on hover. Normally Elementor supports dynamic fields like this, but the new Loop Builder feature has some issues dynamic data or ACF Fields.
I tried to add it with css based on the tutorial from this article, but if i add the php code to the CSS in Elementors Custom CSS field, i get an unknown property error message.
https://www.advancedcustomfields.com/resources/color-picker/
Is there maybe a workaround?
Thank you in advance!
Hi all,
Using WordPress (latest version) Custom Post Types (latest version), ACF Pro (latest version) and Elementor Pro (latest version)
I am posting my problem here because I have come up against a brick wall trying to get support for the issue, both from ACF Pro and from Elementor Pro.
My website uses Custom Post Types (latest version), ACF Pro (latest version) and Elementor Pro (latest version), and has been working perfectly for 3 years, until about 1-2 weeks ago. Then I started to get Warning messages on the web page that uses ACF Pro fields to display a CPT called “products” (NOT Woocommerce products because this is a “catalog” site, not an e-commerce site, and I am not using Woo anyway). Plus, I have NO WARNINGS ACTIVATED inside any plugin on the site, nor in the wp_config.php file (DEBUG = FALSE) so the first thing I’d like to know is why I am seeing Warnings at all! Fatal errors – fine, I expect to see those if something bad goes wrong, but why is my site being defaced by mere Warnings?
I would like to post a screenshot of these warnings, but no way to do so on this forum.
Basically, I get a message like this, but repeated 14 times in a row at the top of the web page:
Warning: Undefined array key 0 in /home/clients/[cient-number]/web/wp-content/plugins/elementor-pro/modules/dynamic-tags/acf/tags/acf-image.php on line 40
The only variation to this message is as follows, where acf-url.php replaces acf-image.php.
Warning: Undefined array key 0 in /home/clients/[cient-number]/web/wp-content/plugins/elementor-pro/modules/dynamic-tags/acf/tags/acf-url.php on line 34
I do not have any caching plugin, and clear my brower cache all the time when working on the site, compulsively.
ACF Pro says the problem comes from Elementor, and Elemntor’s reply to me shows they clearly have no clue what is causing it.
At this stage I would be very happy to just comment out the code causing the problems, but have no idea how “essential” it is to ACF functionality. I have quite a lot of php dev experience, but zero experience of the WP framework and how the core & plugins fit together.
Can someone somewhere give me ANY pointers here?
Many thanks
SH
Hello everyone,
for quite some time I have been looking for solutions for this feature of mine, if anyone can help me I would be really happy.
With a relationship field, article object, I created a select of 3 products from my e-commerce on woocommerce. With this code I was able to get the image, I would also need to get the attributes of the various products and link to each product the attributes and the buy button. Does anyone know how to do this?
<?php
$posts = get_field(‘product_id’);
if( $posts ): ?>
<?php the_field(‘field_name’, $p->ID); ?>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
Hello, I have used ACF to show a field group attached to a product-tag in woocommerce, which works great. The website uses Elementor as a builder. I have successfully made a header (text) and a description (text area) to be shown on taxonomy equal to product-tag.
I go into product-tag in wordpress and the text and text area are shown to be filled in. However, I have tried to add an image field and everything is fine until I fill in one of the text fields in my product tag and the image field disappears. Has anybody come across this, I thought perhaps I may have to purchase the pro version to enable images. I really don’t want to spend money until I am sure it will work for me
Hi,
We’re using Woocommerce Bookings with resources assigned to each booking product – in this the resources are instructors.
We’ve created an ACF field for instructor email address and assigned it to the resource.
What we need to do now is trigger an email using Automate Woo when a booking is made that is sent to the associated instructor.
Automate Woo allows creation of custom variables to use within each automation workflow.
https://automatewoo.com/docs/variables/custom-variables/
Can anyone give me any pointers for adapting the custom variable code to pass the email field to use in the email?
Thanks
Hi,
I cannot find an answer for this anywhere, but imagine it’s fairly simple.
I have added a simple checkbox field to Woocommerce Orders. I want to display this (and ideally be able to sort with it i.e. checked vs not checked) in the Woocommerce orders overview page (Woocommerce>orders).
Other plugins I have added to the site have options under Screen Options but I do not know how to get ACF fields up there.
Any help greatly appreciated
Hey,
I need to get all the field settings assigned to a custom post type. There is this function get_field_objects() that returns the field parameters saved on a specific post (by its id). But I need the equivalent on post type.
For example, get_post_type_field_objects(‘product’) to get all field parameters assigned to WooCommerce products in general.
Does this function exist? If it doesn’t exist, how do you code it? I’m ok with the SQL.
Have a nice evening.