0

In 'new product page' i'm using custom meta fields. They're extensive and use custom functions to process data. Now in product type [variation] i need to take those meta fields which are coming from parent and save them for all it's children.

I know there is the way of creating the same fields for children of variations. It won't work in my case because i have already processed data in parent fields. Also i would have to duplicate functions and process this data over again..

Simplifying what i want to do : save parent meta field for each children of variation.

My code (saving only parent meta) :

function custom_fields_save( $post_id){
    $product_brand = $_POST['_product_brand'];
    $product_shipment = $_POST['_shipping_time'];

    update_post_meta( $post_id, '_product_brand', $product_brand);
    update_post_meta( $post_id, '_shipping_time', $product_shipment);
}
add_action( 'woocommerce_process_product_meta', 'custom_fields_save' ); 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.