Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Removing the variant's query parameter from the URL and just keeping the color

Vote:
 

Hello, 

How can we achieve the result below, when we actually have the following URL structure:

Actual URL Structure (includes the variation code) Ideal URL Structure (Includes only the color name, the size is not needed in the URL)
Master Product 221317 https://www.domain.com/en-ca/clothing/tops/ity-blazer/ https://www.domain.com/en-ca/clothing/tops/ity-blazer/
  - Pink (3847) S https://www.domain.com/en-ca/clothing/tops/ity-blazer/?variationCode=221317_3847_S_1 https://www.domain.com/en-ca/clothing/tops/ity-blazer/?color=pink
  - Pink (3847)  M https://www.domain.com/en-ca/clothing/tops/ity-blazer/?variationCode=221317_3847_M_1 https://www.domain.com/en-ca/clothing/tops/ity-blazer/?color=pink
  - Pink (3847)  L https://www.domain.com/en-ca/clothing/tops/ity-blazer/?variationCode=221317_3847_L_1 https://www.domain.com/en-ca/clothing/tops/ity-blazer/?color=pink
  - Taupe (8012) S https://www.domain.com/en-ca/clothing/tops/ity-blazer/?variationCode=221317_8012_S_1 https://www.domain.com/en-ca/clothing/tops/ity-blazer/?color=black
  - Taupe (8012) M https://www.domain.com/en-ca/clothing/tops/ity-blazer/?variationCode=221317_8012_M_1 https://www.domain.com/en-ca/clothing/tops/ity-blazer/?color=black
  - Taupe (8012) L https://www.domain.com/en-ca/clothing/tops/ity-blazer/?variationCode=221317_8012_L_1 https://www.domain.com/en-ca/clothing/tops/ity-blazer/?color=black

We are using Commerce 13.3

Thanks!

#267655
Dec 01, 2021 16:44
Vote:
 

I suppose you can change your ProductController's Index action

public ActionResult Index(FashionProduct currentContent, string color = "")

of course in there you need to handle sizes, but the url generated should be that 

#268027
Dec 08, 2021 6:36
Vote:
 

Thank you Quan!

#268194
Dec 10, 2021 14:53
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.