WP SITES

3087 Coded Tutorials & 293 Plugins

Display GTIN on Single Product Page

Add this code to your child themes functions file or custom code snippets plugin to display the product GTIN number on the single product page using WooCommerce.

add_action( 'woocommerce_single_product_summary', function() {
    global $product;
    $gtin = get_post_meta( $product->get_id(), '_global_unique_id', true );
    if ( $gtin ) {
        echo '<p class="product-gtin">GTIN: ' . esc_html( $gtin ) . '</p>';
    }
}, 25 );

In this case we use the woocommerce_single_product_summary hook however you can use any other single product page hook.

Add your Global Trade Item Number in this field :

GTIN for Variations

Need to add the number on single variable product pages? Try this plugin.

Leave a Reply

New Plugins