Tell me, how would you implement such a functional? Variable product in Woo. We are in the "Product card number 1" on which the link, when you click on the link, displays the buyer to the "Product card number 2" i. clicking on the link, BUT if we chose color: “Green” in “Product Card No. 1”, then when we switch to “Product Card No. 2” we will switch to the default value of the variable product “Blue” color, not color: “Green ".

Question: "How to implement the transition from" Product Card No. 1 "to" Product Card No. 2 "while maintaining the selected color options:" Green "-" Green "

Thank you in advance.

  • The easiest way to link an event to a click / change in product color is 1 change in reference to item 2, which is not the desired color for item 2. - Nik Horse

1 answer 1

First you need to figure out how to create a link to a specific version of the product. Suppose your variable item has an attribute Color with the values ​​Blue, Red, White. Then the link to the blue product looks like this:

http://test.kagg.eu/product/quia-qui-atque-quia-magnam/?attribute_pa_color=blue 

You can check it on my test site. The substrings attribute and pa must always be present, the rest depends on the values ​​for your product.

Now it becomes clear sequence of actions:

  • put the onclick handler on the link to Item 2
  • On click, we read the user-selected attribute value of the current product from select id="pa_color"
  • edit the link to Item 2 so that it acquires the view described at the beginning of the answer
  • navigating using window.location.href
  • Yes, but the link looks like: ...... / product / bluza-sky-color / and when choosing a color does not change in this case, can it somehow be implemented through a cookie? - WebDev pm