Hi Creedon, I currently have a problem with this too. I have try your code too but it don't work with me. Could you help me solve this problem ??? Thank you so much !
Here is my Product URL : https://origine-studiolinear.squarespace.com/kooij/p/chubby-chair-kooij
and here is my URL : https://origine-studiolinear.squarespace.com/chubby-chair-kooij
Here my Code :
<script>
$( ( ) => {
/*
redirect cart item link urls
SS Versions : 7.0, 7.1
*/
const urlSlugMap = {
'store' : { /* for a single Store page, copy value here from
Store Settings > General > URL SLUG field. you only need
exactly what can be selected from the field */
/*
the format of each line is a Product URL and a Page URL Slug
for each product, copy a value from Edit Service Product > Options >
Product URL field. you only need exactly what can be selected from the
field
for a single Page, copy a value from Page Settings > General >
URL SLUG field. you only need exactly what can be selected from the
field
*/
// '[enter product url field here]' : '[enter page url slug here]',
'/kooij/p/chubby-chair-kooij' : '/chubby-chair-kooij',
'2' : 'b',
'3' : 'c',
}
}
const errorPageUrlSlug = 'error'; /* page to go to in case a product url
is not found */
// do not change anything below, there be the borg here
if ( window.location.pathname != '/cart' ) return;
$( '.cart-container a' ).each ( function ( ) {
let $this = $( this );
let href = $this.attr ( 'href' );
if ( href in urlMappings ) {
href = urlMappings [ href ];
} else {
href = urlError;
}
$this.attr ( 'href', href );
} );
} );
</script>