Looking to get the custom fields of a WooCommerce attribute with Advanced Custom Fields? All you may need is to pass these arguments into the get_field() ACF function.
Getting the advanced custom field from a WooCommerce attribute
To get the custom field (ACF) from a WooCommerce attribute, you must understand that WooCommerce uses the pa_ prefix on their attributes.
For example, in order to get a thumbnail image from an ACF field for a WooCommerce attribute, you could use the code below.
$terms = get_terms( 'pa_yourattribute' , array( 'hide_empty' => false ) ); foreach( $terms as $term ) : $thumbnail_image = get_field( 'your_acf_field', 'pa_yourattribute_' . $term->term_id ); echo $thumbnail_image['url']; endfor;