Hi there, has anyone had any luck with integrating into WooCommerce? I can’t seem to get anywhere with it.
I’m trying to bring in ACF on the single product pages and in the category archive, but it just won’t work. In fact, the string breaks any code within that function thereafter.
I have searched this forum and done many a Google and found very little information with ACF in Woocommerce. Could anyone point me in the right direction please?
Thanks
Hi @s7media
WooCommerce has different template structure where you need to add the code. This page should give you more idea about it: https://docs.woocommerce.com/document/template-structure/.
If the code is located inside of the product loop, you should be able to use the get_field()
or the_field()
functions in a standard way. But if it’s located outside of the loop, then you need to pass the product ID to the second parameter of the get_field()
or the_field()
functions like this:
get_field('custom_field_name', 99);
Where “99” is the product ID.
For the product category, kindly check our tutorial here: https://www.advancedcustomfields.com/resources/get-values-from-a-taxonomy-term/.
If you don’t know how to get the product ID or which file you should modify, kindly get in touch with WooCommerce support instead.
I hope this makes sense 🙂
Howdy, James – great name, btw.
Just upgraded to Pro and looking for the way to hook a Field Group into the dropdown found at Attributes >> Custom product attribute
. Had no issue adding 35 Select dropdowns to WooCommerce Single Products.
But I don’t want them in a separate place like this. I need to add Custom Fields to the Attributes >> Custom product attribute
dropdown. This one.
Ideally, these custom taxonomies would also be automatically added to the Products >> Attributes
page. This one.
Are you able to point me in the right direction to make this happen?
Thanks!