V
V
Vaha Vaynahskiy2018-05-08 14:42:01
WordPress
Vaha Vaynahskiy, 2018-05-08 14:42:01

How to display custom field (ACF) of product on Woocommerce cart page?

Good afternoon!
Created a custom ACF field for products and displayed it in the product card, everything is displayed, tell me how to display this field on the cart page
PS: Created a custom field so that products have different classes \ id

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Vorotnev, 2018-05-08
@vainax

Field values ​​are retrieved via the ACF get_field() (or the_field) API. The first parameter is the name of the field, the second (optional) is the ID of the record with which this field is associated (there are still terms, users, options - but this does not apply to this issue). Take the product record ID and pass it to the function:
the_field( 'field_name', $product_id );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question