Support

Account

Home Forums Backend Issues (wp-admin) Add WooCom Data to custom field

Unread

Add WooCom Data to custom field

  • Hi.
    I would like to know how to copy woocom info into custom fields.

    Below is a basic example of me trying to add the product length to a variable then updating a custom field on save… Any ideas?

    function my_acf_save_prod( $post_id ) {
    	
    	global $product; 
    	
    if ( 'product' == $post_type ) {
        $p_width = $product->get_width();
        update_field('productsheetareacm2', $p_width);
    }
    
    }
    
    add_action('acf/save_post', 'my_acf_save_prod', 20);
Viewing 1 post (of 1 total)

The topic ‘Add WooCom Data to custom field’ is closed to new replies.