How to display Advance Custom Fields on WooCommerce Single Product Page ?

Photo of author
Written By geekerhub

Lorem ipsum dolor sit amet consectetur pulvinar ligula augue quis venenatis. 

It is easy to create Custom Fields using the ACF plugin , but when come to display those data it seems to be struggling.
In WooCommerce, one can achieve to display custom field on single product page using the filter or action hook of WooCommerce.

You must know the hooks associated with the respective page of WooCommerce.

For single product page, we can use below code snippet to show the ACF field value below WooCommerce product thumbnails.

add_action( 'woocommerce_before_single_product', 'geeker_display_acf_field_on_single_product', 30 );
 function geeker_display_acf_field_on_single_product() {
   echo 'Price: ' . get_field('price');
   // Note: 'price' is the slug of the ACF Field for single product page

List of hooks associated with single product page. You can use any hook listed below to display ACF field value at specific section on single product page.

  • woocommerce_before_single_product
  • woocommerce_before_single_product_summary
  • woocommerce_single_product_summary
  • woocommerce_product_thumbnails
  • woocommerce_before_add_to_cart_form
  • woocommerce_before_variations_form
  • woocommerce_before_add_to_cart_button
  • woocommerce_before_single_variation
  • woocommerce_single_variation
  • woocommerce_after_single_variation
  • woocommerce_after_add_to_cart_button
  • woocommerce_after_variations_form
  • woocommerce_after_add_to_cart_form
  • woocommerce_product_meta_start
  • woocommerce_product_meta_end
  • woocommerce_share
  • woocommerce_after_single_product_summary
  • woocommerce_after_single_product

Leave a Comment