Add custom ACF field data to WooCommerce single product pages using hooks.
Display a field after the product summary (price, description, add to cart):
<?php
add_action( 'woocommerce_single_product_summary', function () {
$specs = get_field( 'technical_specs' );
if ( $specs ) {
echo '<div class="product-specs">';
echo '<h3>Technical Specifications</h3>';
echo wp_kses_post( $specs );
echo '</div>';
}
}, 35 );
Add a custom product tab with ACF field content:
<?php
add_filter( 'woocommerce_product_tabs', function ( $tabs ) {
$sizing = get_field( 'sizing_guide' );
if ( $sizing ) {
$tabs['sizing_guide'] = [
'title' => 'Sizing Guide',
'priority' => 25,
'callback' => function () use ( $sizing ) {
echo '<h2>Sizing Guide</h2>';
echo wp_kses_post( $sizing );
},
];
}
return $tabs;
} );
Display fields after the product meta (SKU, categories, tags):
<?php
add_action( 'woocommerce_product_meta_end', function () {
$origin = get_field( 'country_of_origin' );
$material = get_field( 'material' );
if ( $origin ) {
echo '<span class="posted_in">Origin: <strong>' . esc_html( $origin ) . '</strong></span>';
}
if ( $material ) {
echo '<span class="posted_in">Material: <strong>' . esc_html( $material ) . '</strong></span>';
}
} );
Common WooCommerce hook priorities for woocommerce_single_product_summary:
- 5 — Title
- 10 — Rating
- 10 — Price
- 20 — Excerpt
- 30 — Add to cart
- 40 — Meta (SKU, categories)
Choose a priority number to control where your custom fields appear.