Forum Replies Created

Viewing 1 replies (of 1 total)
  • cronlin

    (@cronlin)

    Hi, i have this situation:

    In function.php:

    
    function th43er_wc_rest_prepare_order_object( $response, $object, $request ) {
    	// Get the meta value
    	$your_field_value = ( $value = get_post_meta($object->get_id(), 'wflink', true) ) ? $value : '';
    	
    	// Set the meta value in API responce
    	$response->data['wflink'] = $your_field_value;
    
    	return $response;
    }
    add_filter( 'woocommerce_rest_prepare_shop_order_object', 'th43er_wc_rest_prepare_order_object', 10, 3 );
    
    

    IN GOOGLE SHEET SCRIPT:

    var your_field_value = myData.wflink;

    I have put a custom field in a product called wflink but in google sheet following the code on top in this discussion i receive all other order information but my custom field column is still empty..

    Why?

    I have try also:

    
    var your_meta_data_field_key = myData.meta_data[i]["wflink"];
    

    but not work.

    Can you help me? Thank you!

    • This reply was modified 4 years ago by cronlin.
Viewing 1 replies (of 1 total)