I try to create a UPC field for my variable product and put it somewhere on the single product page. I am able to find the script code for the current variation id based on the attribute selected, but I don’t know how to connect the script to the get_field().
I understand the get_field($selector, [$post_id], [$format_value]);.
I want this [$post_id] change based on the attribute selected value.
I found the script code below the I can get the current variation ID base on the attribute selected.