To change Product URL, you can follow these.
#1. Change Product to Custom Page URL/or Custom External URL
First, find Product URL.
In my example, we will have:
/store/p/earth-sky-planter-4awkk-nazcb-lbzst
/store/p/milk-dip-cup-92wf6-abmpj-t9pj3
/store/p/country-feast-set-3nybt-zczh5-7w375
Next, use code to Code Injection > Footer
If code doesn’t work, you can comment below, message or send me an email.
<script>
const config = {
item1: {
selector: 'a.grid-item-link[href="/store/p/earth-sky-planter-4awkk-nazcb-lbzst"]',
newUrl: 'https://www.google.com'
},
item2: {
selector: 'a.grid-item-link[href="/store/p/milk-dip-cup-92wf6-abmpj-t9pj3"]',
newUrl: 'https://www.instagram.com'
},
item3: {
selector: 'a.grid-item-link[href="/store/p/country-feast-set-3nybt-zczh5-7w375"]',
newUrl: 'https://www.linkedin.com'
}
};
for (const [key, value] of Object.entries(config)) {
const element = document.querySelector(value.selector);
if (element) {
element.setAttribute('href', value.newUrl);
console.log(`Updated [${key}]: ${value.selector} -> ${value.newUrl}`);
} else {
console.warn(`Element not found for [${key}]: ${value.selector}`);
}
}
</script>
Remember to update URLs in the code.
#2. Change Product to internal url
First, hover on a Product > Click 3 dots > Click Settings
Scroll down to SEO and URL > Click EDIT
You can change URL here then click Apply.
Then click Save