Display custom field for chosen variation
-
Hi,
I have added a single custom field to my product variations: retailer_url. I should like to display this once the customer has selected his variation from the dropdown – just after the variation price is displayed.
I think I probably need to add a function to the woocommerce_single_variation hook, and use get_post_meta to retrieve the value of the custom field.
How how on earth do I know what the selected variation id is?
I’ve read loads of posts that refer to similar problems, but nothing that exactly answers my question. Will I need JavaScript to access the id of product variation that was selected from the dropdown? Or is it held in a variable – and, if so, what?
Thanks.
- The topic ‘Display custom field for chosen variation’ is closed to new replies.