php – Display custom field value in woocommerce variable product via jQurey


I try to display the custom value fields that each variation has.

I use this code to display variation id and variation description:

add_action( 'woocommerce_before_single_variation',
 'action_wc_before_single_variation' );
function action_wc_before_single_variation() {
    <script type="text/javascript">
        $('form.variations_form').on('show_variation', function(event, data){
            console.log( data.variation_id );      // The variation Id  <===  <===
            console.log( data.variation_description );        // The variation description  <===  <===


Now I want to show these fields from the picture in the same function.

Metadata fields

Is that possible?

MrBrabus 12 months 2021-10-08T12:24:24-05:00 0 Answers 0 views 0

Leave an answer