<p>Go to admin panel <code>settings-&gt;routes</code> 
And do something like: </p>

<p>First <code>*</code> is your product-slug, Second <code>*</code> is your variant unique value, could be <code>SKU</code> or some other custom field you have.</p>

<p><a href="https://i.sstatic.net/coVyb.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/coVyb.png" alt="enter image description here"></a></p>

<p>Then in your <code>your-product-detail.twig</code></p>

<pre><code>   {% set productSlug = craft.app.request.segments()[1] %} 
   {% set variantUniqueValue = craft.app.request.segments()[2] %}
</code></pre>

<p>Then based on these two values, do craft variant query to get variant information and display it.</p>

CC BY-SA 4.0
2019-07-18T04:30:06.593Z
2019-07-18T04:30:06.593Z
Parry Huang
<p>I am considered the best way to set this up in Craft and how to handle this with front-end Urls, templates and routes?</p>

<p>So I products with variants for Wheel Spacers, (Wheel Spacers are a product type), these wheel spacers will be related to specific vehicles (vehicles is a separate channel). As these spacers will be related to several vehicles, it doesn't make sense to duplicate them as multiple products.</p>

<p>However, the part I am stuck with is how to list these products in multiple instances on the front-end so that it uses the same product but various information is pulled in from the vehicle. As an example.</p>

<p>Say the product <em>4x100 56.1 Wheel Spacers (4100561)</em> relates to the following vehicles:</p>

<ul>
<li>Audi Q7 (2009-15)</li>
<li>Mini Cooper S (2002-2006)</li>
<li>Mini Cooper S (2006-2012)</li>
<li>Mini Cooper (2008-2012)</li>
<li>Mini Cooper (2012-)</li>
<li>BMW Z1 (2012-)</li>
</ul>

<p>I would like to show the product  4x100 56.1 Wheel Spacers (4100561) as separate pages for each of those models. With each one showing dynamic information for the SEO meta,  and description, this would be pulled in dynamically e.g</p>

<ul>
<li>Audi Q7 (2009-15) 4x100 56.1 Wheel Spacer</li>
<li>Mini Cooper S (2002-2006) 4x100 56.1 Wheel Spacer</li>
<li>Mini Cooper S (2006-2012) 4x100 56.1 Wheel Spacer</li>
<li>Mini Cooper (2008-2012) 4x100 56.1 Wheel Spacer</li>
<li>Mini Cooper (2012-) 4x100 56.1 Wheel Spacer</li>
<li>BMW Z1 (2012-) 4x100 56.1 Wheel Spacer</li>
</ul>

<p>At the same time user will be able to browser by product types (Wheel Spacers, Adapters, Fixings etc) but also by Vehicle Manufacture (Audi) and Model (Q7 (2009-15)) etc</p>

<p><strong>If anyone can give me thoughts on the best way to structure this in Craft CMS and how to best structure the templates, the URLs and routes?</strong></p>

<p>Thanks,</p>

<plugin-craftcommerce><structure><plugin-craftcommerce2>
Show multiple products (urls/pages) on the front-end with dynamic titles/descriptions/meta based on a single product in Craft Commerce
# Show multiple products (urls/pages) on the front-end with dynamic titles/descriptions/meta based on a single product in Craft Commerce

(Asked by: username_0 on 2019-07-17)

I am considered the best way to set this up in Craft and how to handle this with front-end Urls, templates and routes?

So I products with variants for Wheel Spacers, (Wheel Spacers are a product type), these wheel spacers will be related to specific vehicles (vehicles is a separate channel). As these spacers will be related to several vehicles, it doesn't make sense to duplicate them as multiple products.

However, the part I am stuck with is how to list these products in multiple instances on the front-end so that it uses the same product but various information is pulled in from the vehicle. As an example.

Say the product *4x100 56.1 Wheel Spacers (4100561)* relates to the following vehicles:

* Audi Q7 (2009-15)
* Mini Cooper S (2002-2006)
* Mini Cooper S (2006-2012)
* Mini Cooper (2008-2012)
* Mini Cooper (2012-)
* BMW Z1 (2012-)

I would like to show the product 4x100 56.1 Wheel Spacers (4100561) as separate pages for each of those models. With each one showing dynamic information for the SEO meta, and description, this would be pulled in dynamically e.g

* Audi Q7 (2009-15) 4x100 56.1 Wheel Spacer
* Mini Cooper S (2002-2006) 4x100 56.1 Wheel Spacer
* Mini Cooper S (2006-2012) 4x100 56.1 Wheel Spacer
* Mini Cooper (2008-2012) 4x100 56.1 Wheel Spacer
* Mini Cooper (2012-) 4x100 56.1 Wheel Spacer
* BMW Z1 (2012-) 4x100 56.1 Wheel Spacer

At the same time user will be able to browser by product types (Wheel Spacers, Adapters, Fixings etc) but also by Vehicle Manufacture (Audi) and Model (Q7 (2009-15)) etc

**If anyone can give me thoughts on the best way to structure this in Craft CMS and how to best structure the templates, the URLs and routes?**

Thanks,

**Tags:** plugin-craftcommerce, structure, plugin-craftcommerce2

---

## 1 answers

### Answer by username_1 on 2019-07-18. Score: 2

Go to admin panel settings->routes 
And do something like: 
First * is your product-slug, Second * is your variant unique value, could be SKU or some other custom field you have.

Then in your your-product-detail.twig
   {% set productSlug = craft.app.request.segments()[1] %} 
   {% set variantUniqueValue = craft.app.request.segments()[2] %}

Then based on these two values, do craft variant query to get variant information and display it.


---

