Home » WooCommerce: Display Advanced Custom Fields @ Single Product

WooCommerce: Display Advanced Custom Fields @ Single Product

by adminkys

Advanced Custom Fields plugin is a great way to add custom, advanced fields to the WooCommerce Single Product Page. Many struggle to display such fields on the front-end, so this simple snippet should help you!

WooCommerce: display Advanced Custom Field @ single product page

PHP Snippet: Display Advanced Custom Fields @ WooCommerce Single Product Page

/**
 * @snippet       Display Advanced Custom Fields @ Single Product - WooCommerce
 * @how-to        Get tutoraspire.com FREE
 * @sourcecode    https://tutoraspire.com/?p=22015
 * @author        Tutor Aspire
 * @compatible    WooCommerce 3.5.7
 * @donate $9     https://www.tutoraspire.com
 */ 
 
add_action( 'woocommerce_product_thumbnails', 'tutoraspire_display_acf_field_under_images', 30 );
 
function tutoraspire_display_acf_field_under_images() {
  echo 'Trade Price: ' . get_field('trade');
  // Note: 'trade' is the slug of the ACF
}

You may also like