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.
This topic has 4 replies, 2 voices, and was last updated 5 days, 13 hours ago ago by Jack Richardson
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.
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
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
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
You must be logged in to reply to this topic.Log in/Sign up