Prepending product.vendor to product.url

betasl
New Member
7 0 0

Hi team,

I've been trying to figure out how to automatically prepend the vendor to the product url in the product-card-grid section on Debut theme:

Here's the relevant code:

 href="{{ product.url | within: collection }}">

I want it to actually be:

href="{{ product.url | prepend: product.vendor | replace: ' ', '-' }} "

but I don't know the correct way to do this, any help?

 

0 Likes
Guleria
Shopify Partner
1255 263 346

Try this

href="{{ product.url | within: collection }}/{{ product.vendor }}"
Want to modify or custom changes on store hire me.
Email: guleriathakur43@gmail.com, Skype: navrocks1
If helpful then please Like and Accept Solution.
If you are happy and want to donate Click here (Its my paypal)
0 Likes
betasl
New Member
7 0 0

Hi there,

that returns:

/collections/product.collection/products/product.title/product.vendor

which 404's

it needs to be

/products/product-vendor-product-url

i'm not concerned with included within: collections at the moment

0 Likes
betasl
New Member
7 0 0

I ended up manually editing all product URL's manually as the store a small inventory but would be helpful to know for the future.

0 Likes
Guleria
Shopify Partner
1255 263 346

the use this

<a href="/products/{{ product.vendor | handleize }}">
Want to modify or custom changes on store hire me.
Email: guleriathakur43@gmail.com, Skype: navrocks1
If helpful then please Like and Accept Solution.
If you are happy and want to donate Click here (Its my paypal)
0 Likes
betasl
New Member
7 0 0

Hi there,

you don't need to manually add /products/

 

and I believe the outcome of your solution would be:

/products/product-vendor/
0 Likes