How to generate short links to WooCommerce products using Jetpack and WP.me

Often we have products for which WooCommerce the URL or permanent link generated by WooCommerce is very long because it generates it with the product name. Well, to solve this, a very useful free tool when using WordPress y WooCommerce is Jetpack is a set of security, performance, and growth tools designed by WordPress experts from the company Automattic for WordPress sites.

But before starting the tutorial, let's begin with the basics.

What is a Permanent Link?

Permalink is the abbreviation for «permanent link.» These are permanent URL structures used to help organize your website's content (pages, posts, products, etc.) so that users and bots can navigate, share, and reference it quickly and orderly.

The permalink settings for WooCommerce can be found in WordPress > Settings > Permalinks.

image
The WordPress Administration Menu where permalink configuration is located.

From here, you can configure the URL structure for your store and product pages.

Before starting

You should consider that you should already have installed:

How to install Jetpack?

First, we must access our WordPress panel at https://www.mysite.com/wp-admin/. We must enter our username and password. Then, after accessing the WordPress panel, we must navigate to the administration panel menus, Plugins > Add New.

image 2

Then, we need to click on the search bar that appears in the upper right corner.

image 3

In the search bar, we will type the term “Jetpack.”.

image 4

Then, we must click on the "Install Now" option.

image 5

Click on “Activate”

image 6

Then, we must click on “Settings.”.

image 7

We will click on the “Traffic” tab.

image 8

We scroll down to the WP.me Short Links option and enable it.

Finding the short link for a post or page

To find the short link for a post/page, on the editing screen, click the green Jetpack icon in the upper right corner to open the Jetpack sidebar:

image 9

Next, you will see the shortlink URL in the Shortlink section, where you can copy it to your clipboard:

Note: If you are using the Classic Editor, you will see a ‘Get Shortlink’ button next to the permalink, just below the post title. Clicking that button will display the short link in a pop-up window:

image 10

How to enable short links for WooCommerce products?

To do this, add the following code to your child theme or a plugin like Code Snippets.

<?php
add_action('init', 'add_products_shortlinks');
function add_products_shortlinks() {
    add_post_type_support( 'product', 'shortlinks' );
}
?>

Once the code is installed in our child theme or in a plugin like Code Snippets. We can navigate to the products and obtain the short link by clicking the “Get Shortlink” button.

image 11

Conclusion

It is common to find some negative reviews about Jetpack, but I believe most are unfounded and are rumors. Jetpack does not have a negative impact on site performance, and it also has many functionalities, such as the one mentioned in this tutorial, which we as WordPress developers can fully leverage using its paid and free versions.

Still have doubts?

Do you need help with a web project? Don't hesitate to contact me. I develop complete and customized solutions with WordPress and PHP, using modern tools and processes, HTML, CSS, SCSS, PHP, JavaScript, Bootstrap, and more. Ready? Send me a message and let's talk about your web project!