Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
Hello everyone, i created a google sheet function to create faster handles, i hope this works for you.
Go to AppScript on google sheets and insert this code as a new function, then you can use =handle("your prodcut titles here") and thats it 😉 this functions puts everything in lower case, ads - to the blank spaces and removes special caracters aswell as accents or weirds things
function handle(texto) {
// Comprueba si se proporcionó un valor.
if (!texto) {
return '';
}
// Reemplaza las vocales y caracteres raros con acento por guiones para las urls de shopi
var textoSinAcentos = texto.toString().replace(/á/g, 'a')
.replace(/é/g, 'e')
.replace(/í/g, 'i')
.replace(/ó/g, 'o')
.replace(/ú/g, 'u')
.replace(/Á/g, 'A')
.replace(/É/g, 'E')
.replace(/Í/g, 'I')
.replace(/Ó/g, 'O')
.replace(/Ú/g, 'U')
.replace(/ñ/g, 'n')
.replace(/Ñ/g, 'N')
.replace(/ /g, '-')
.replace(/\(/g, '-')
.replace(/\)/g, '-')
.replace(/&/g, '-')
.replace(/\*/g, '')
.replace(/,/g, '')
.replace(/\./g, '')
.replace(/\+/g, '-')
.replace(/\//g, '-');
var textoEnMinusculas = textoSinAcentos.toLowerCase();
return textoEnMinusculas;
}