Display _global_unique_id meta on product page

This topic has 2 replies, 2 voices, and was last updated 1 day, 10 hours ago ago by Jack Richardson

  • Avatar: Hangato
    Hangato
    Participant
    June 10, 2026 at 10:22

    Greetings,
    I’d like to be able to display WooCommerces own EAN field in Product Meta, not the field XStore creates. How can I achieve this?

    Best regards

    1 Answer
    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    June 10, 2026 at 13:15

    Hello @Hangato,

    You can add the following custom PHP snippet to your child theme’s functions.php file:

    add_filter('etheme_product_meta_elements', function ($elements) {
        $elements['et_woo_gtin'] = esc_html__('Woo GTIN', 'xstore-child');
        return $elements;
    });
    
    add_action('etheme_product_meta_element_render', function($key, $local_product, $edit_mode, $_this) {
    	switch ($key) {
    		case 'et_woo_gtin':
    			$gtin = $local_product->get_global_unique_id();
    			$gtin_caption = esc_html__('GTIN', 'xstore-child');
    			if ( $gtin ) { ?>
    				<span class="et_woo_gtin_wrapper detail-container">
                        <span class="detail-label"><?php // PHPCS - the $sku_caption variable is safe. ?><?php echo $gtin_caption; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
                            </span>
                        <span class="et_woo_gtin"><?php // PHPCS - the $sku && $sku_missing variables are safe. ?><?php echo $gtin; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
                            </span>
                    </span>
    				<?php
    			}
    			break;
    		
    		default:
    			// code...
    			break;
    	}
    }, 10, 4);

    Next, open your Single Product Builder (XStore Builders → Single Product Builder → Elementor Editor) and check the Product Meta widget. You will find a new option to display the Woo GTIN (you can modify the text in your code if needed as the WooCommerce provide one field for GTIN, UPC, EAN, or ISBN): https://gyazo.com/1606eb3947d2a7c2454338a458b64f77.

    On the frontend (https://gyazo.com/732c5f36d4697edec8873e699da57849), you will see the correct GTIN value that you set in your product backend (https://gyazo.com/17e2bfbee0ddd1c51b68be9b889f5a93).

    If you still require assistance, please provide us with temporary WP-Admin and FTP access to your website.

    Best regards,
    Jack Richardson
    The 8Theme’s Team

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

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

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