Hey @discountpleasure,
Add the following code to your theme’s functions.php
or a custom plugin:
function display_product_shortlink() {
if (is_product()) {
global $post;
echo '<p><strong>Shortlink: </strong><a href="' . wp_get_shortlink($post->ID) . '">' . wp_get_shortlink($post->ID) . '</a></p>';
}
}
add_action('woocommerce_single_product_summary', 'display_product_shortlink', 25);
If you’re using Elementor or another builder, register a shortcode:
function product_shortlink_shortcode() {
global $post;
if (!is_product()) return '';
return '<p><strong>Shortlink: </strong><a href="' . wp_get_shortlink($post->ID) . '">' . wp_get_shortlink($post->ID) . '</a></p>';
}
add_shortcode('product_shortlink', 'product_shortlink_shortcode');
If you need anything, feel free to connect with me.
Best Regards
Ravindra Singh Meyda