I have two attributes in my woocommerce single product page that I have added, "Metal" and "Ring Size". They are "variations" such that they are drop down selections on my product page.
I want to be able to on click of my button, I can be able to grab the selected value and put it onto my URL parameter.
I solved everything up to the part where the value that is grabbed isn't correct.
I have so far tried this but it is just giving me a list of this attributes possible values/selections and not the single selected value..
$metal = $product->get_attribute( 'Metal' );
http://example.com/?metal=18K%20White%20Gold%20|%2018K%20Yellow%20Gold%20|%20Rose%20Gold%20|%20Platinum
I just want what I selected on the drop down, something like this:
http://example.com/?metal=Platinum