The syntax to get the ACF field of a custom taxonomy is:
$var = get_field('name_of_acf_field', 'name_of_taxonomy' . '_' . taxonomy_ID);
so in your case you’ll need to get product_cat ID before and do something like:
add_action( 'woocommerce_shop_loop_item_title', 'VS_woo_loop_product_title', 10 );
function VS_woo_loop_product_title() {
echo '<h3>' . get_the_title() . '</h3>';
$terms = get_the_terms( $post->ID, 'product_cat' );
if ( $terms && ! is_wp_error( $terms ) ) :
//only displayed if the product has at least one category
$cat_links = array();
foreach ( $terms as $term ) {
$cat_links[] = $term->name;
$cat_id = $term->term_id;
}
$on_cat = join( " ", $cat_links );
$bgcolor = get_field('kollekcio_szine', 'product_cat' . '_' . $cat_id);
?>
<div style="background-color: <?php echo $bgcolor; ?>">
<?php echo $on_cat; ?>
</div>
<?php endif;
}
Related Posts:
- Is it possible to add custom fields to a WooCommerce attribute term? [closed]
- How to display product price of the product in loop
- Display Advanced Custom Fields value in Woocommerce admin order details
- Display custom field without plugin in woocommerce
- Get product variation attribute titles – WooCommerce
- How to add taxonomy term under the thumbnail on woocommerce product page
- Create archive page for woocommerce attribute
- wp_set_object_terms being undone
- Redirect to another page using contact form 7? [closed]
- A function to add arguments to a taxonomy
- Different Templates for Woocommerce Parent and Child Sub Categories
- Need to check if user has completed a woo commerce payment
- How to retrieve a Menu Name by Menu Location with ACF fields
- How to set acf color field as background color to product category
- Split taxonomies on different pages
- Update a list of product to featured if product have meta value (Mysql not wpquery)
- MySQL error or data corruption after database migration
- WooCommerce and ACF: How to Redirect Upon Add to Cart – Partially Working Example
- ACF in WooCommerce mail template
- creating number of database entries based on users numerical input
- How to store ACF from product in user_meta?
- how to get woocommerce product id by acf field in wordpress and display product
- How to get an Array from “select” field in advanced custom fields
- Insert a custom field as a second email address to a completed order in WooCommerce
- cannot create product attribute (taxonomy) and add terms on the same execution
- Add field to category woocommerce page
- acf_form() – “On Update” action [closed]
- Limit users to one active subscription in WooCommerce Subscriptions? [closed]
- WooCommerce add_to_cart() with custom price [closed]
- Declaring custom woocommerce product type as virtual / downloadable only [closed]
- WooCommerce HTML after short description if product is in specific category
- How to get total count for each star rating?
- WooCommerce Apply Coupon to order AFTER taxes
- Rewriting Woocommerce Product Filters To URL Segments
- Auto update cart after quantity change
- echo product id and product_item_key in cart [closed]
- Redirect the single product page link to the shop page
- How can I display *only* the child category of a product?
- How to implement Handling Fee like the Shipping on Cart and Checkout page on WooCommerce [closed]
- why featured product not updated in postmeta table in woocommerce?
- Change Category Widget Dropdown List Select Name
- wooCommerce checkout page State / County (optional) validate not working
- WooCommerce – Multiple meta query not working
- Advanced Custom Fields displaying on tag pages
- WooCommerce limited role
- Skip WooCommerce 4.5.x onboarding with WP-CLI [closed]
- Automatically making a newly saved payment method default in WooCommerce
- Download permission for non-purchased products
- Display FREE for $0 products in woocommerce ++++ [closed]
- How to add existing categories into a post using wp_insert_post
- create comment box in woo-commerce shop order [closed]
- Product variation attributes does not appear as it should in the cart – woocommerce [closed]
- Woocommerce: how to know if the customer is canceled the order or the shop owner? [closed]
- Have I got this IF Statement correct?
- WooCommerce Price Filter not working? [closed]
- How to replace WooCommerce Product Gallery Trigger icon using PHP/CSS? [closed]
- How to display a table below each product in product list/loop
- how to remove this image? [closed]
- Create a shortcode for native WooCommerce search form [closed]
- WooCommerce – Split Multiple Items into Individual Line Items
- Change “Select Options” label in button to “Buy Now!” in store page
- How to use Custom Field to display product brief description in shop page with Woocommerce?
- Woocommerce product import exports product with price rounded to integer? [closed]
- How to hook to function of woocommerce product export _regular_price?
- Add “new” tag for existing products
- CallBack URL for payment gateway redirecting to homepage instead of executing callback function
- Display when items are in Woocommerce cart but hide when empty
- Printing product variation return array to string conversion error
- woocommerce deposit Form with AJAX and shortcode won’t update but add to previous output
- How to update permalink programmatically?
- Cloning product not copying custom taxonomies
- Display shipping class in single product page woocommerce
- Is it ok to 301 redirect product-category pages to custom pages?
- Editing product categories suddenly crashes website and goes back to wordpress installation
- Woocommerce – Add custom email footer to specific email template
- WooCommerce related product – only show from primary category
- I need to refresh the checkout page if someone changes the zip code
- Correct method of reducing the number of images created by WP and Woo together
- add_filter not works in ajax
- How to skip woocommerce checkout after payment page? [closed]
- Product thumbnail size in catalog
- Display custom tax in “while” loop
- how can i import the csv file in wordpress woocommerce.?
- some products free and some product is not free for shipping
- Change wp-login.php? Problem with .htaccess password protection and multi user shop
- Conditional email recipient based off Shipping Method [closed]
- Save Woocomerce discount as percentage to database
- How to bypass Woocommerce checkout validation from the plugin? [closed]
- Category with description and thumbnail
- Custom product loop avoiding duplicates
- Woocommerce – Remove ‘Buy Product’ Button + Make Product Thumbnails Clickable
- Issue with Woocommerce and extra field in orders data
- Display woocommerce product_cat child terms with thumbnails
- Give auto discount to upsells products
- Making product image in woocommerce invoice linkable [closed]
- registration_errors not working
- Translate Woocommerce tab
- Woocommerce -> gallery images per variation without a plugin? [closed]
- Why is my WordPress admin not working
- Create bookings after subscription renewal