How to add EAN code under SKU in single product page?

This topic has 4 replies, 2 voices, and was last updated 5 days, 13 hours ago ago by Jack Richardson

  • Avatar: Kulimary
    Kulimary
    Participant
    May 26, 2025 at 19:25

    Hello

    I want to add EAN to mage single product page.

    I tried applying the solution from this topic : https://www.8theme.com/topic/insert-eangtin-code-to-meta-in-product-page/

    But it has no affect at all
    Plz. help.

    3 Answers
    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    May 27, 2025 at 07:51

    Dear @Kulimary,

    Thank you for reaching out.

    Could you please provide us with more details regarding your implementation? Specifically, we would appreciate it if you could share the code snippet you are using. Additionally, could you confirm whether you have set the GTIN value for the product during testing?

    We look forward to your response.

    Best regards,
    The 8Theme Team

    Avatar: Kulimary
    Kulimary
    Participant
    May 30, 2025 at 10:57

    I tried using this code but it had no effect (so i removed it from my function.php)

    add_action('woocommerce_product_meta_end', function() {
    	global $product;
    	$gtin = get_post_meta( $product->get_id(), '_gtin', true );
    	if ( $gtin == '') return;
    	?>
    	<span class="gtin_wrapper"><?php esc_html_e( 'GTIN:', 'xstore-child' ); ?> <span><?php echo $gtin; ?></span></span>
    	<?php
    });

    And yes my products does in fact have EAN codes setup we are using it to search for products via offical woocommerce app for inventory management purposes.

    See the attached screenshots

    Files is visible for topic creator and
    support staff only.
    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    June 1, 2025 at 12:28

    Hello @Kulimary
    Please, try using next snippet and check the product meta then.

    add_action('woocommerce_product_meta_end', function() {
    	global $product;
    	$global_unique_id = $product->get_global_unique_id();
    	if ( $global_unique_id == '') return;
    	?>
    	<span class="global_unique_id_wrapper"><?php esc_html_e( 'Custom title:', 'xstore-child' ); ?> <span><?php echo $global_unique_id; ?></span></span>
    	<?php
    });

    Kind regards, Jack Richardson
    The 8theme’s team

  • Viewing 4 results - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.Log in/Sign up

Helpful Topics

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.