Skip to content

Instantly share code, notes, and snippets.

@jmabbas
Created January 6, 2026 05:46
Show Gist options
  • Select an option

  • Save jmabbas/19865d0f73618638af3dd9997b717b46 to your computer and use it in GitHub Desktop.

Select an option

Save jmabbas/19865d0f73618638af3dd9997b717b46 to your computer and use it in GitHub Desktop.
Electro - Product id in single product description meta
add_action( 'woocommerce_product_meta_start', 'add_product_id_to_single_meta' );
function add_product_id_to_single_meta() {
global $product;
if ( ! $product ) {
return;
}
echo '<span class="product-id">Product ID: ' . esc_html( $product->get_id() ) . '</span>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment