• Hi everybody,

    I’ve a question that I will try to describe as short as possible:

    I have a Woocommerce webshop with products. When a product has different colors, it is uploaded as a new product. I would like to have a function where people can select a color of the product (add-on), but one that leads them to the product of that color. So when they select brown, it should redirect them to the product that is brown.

    An example of what I mean:
    https://www.bol.com/nl/p/eettafel-liam-180×84-cm/9300000007796893/?s2a=#productTitle

    Thank you for helping me ??

Viewing 1 replies (of 1 total)
  • Hi all

    I am also facing same situation. I know an idea but don’t know it is good or bad.

    There is an id for select attribute drop down ( in case attribute shown as drop down option ) in single product page . Example for color attribute the id should be pa_ + attribute slug in my case pa_color. So what i am thinking is, if i should pass this attribute and its value as a query string like https://example.com/product/product-name/?pa_color=red , based on this $_GET[‘pa_color’] i think we can set selected HTML5 attribute in the option tag based on the condition like

    if( currentOptionValue == $_GET[‘pa_color’] ):
    <option …. selected=”true”>…</option>
    else:
    <option>…</option>
    enif;

    Is the above method is correct?. I didn’t check there is any technical issue will cause based on the above solution.Or there is any other simple methods to do this?

    Please help

    Thanks in advance

Viewing 1 replies (of 1 total)
  • The topic ‘Is this possible in WordPress/Woocommerce?’ is closed to new replies.