No custom field variable when duplicating product
-
Hi,
When duplicating a product which contains a custom field, the variable of that custom field isn’t being duplicated.
I use my own customized code instead of a plugin for my custom field:
Add field:
function wc_extra_product_fields() { woocommerce_wp_text_input( array( 'id' => 'my_field', 'label' => __('Field name') ) ); } add_action( 'woocommerce_product_options_pricing', 'wc_extra_product_fields' );
Save field:
function wc_save_extra_product_fields( $post_id ) { update_post_meta( $post_id, 'my_field', esc_attr( $_POST['my_field'] ) ); } add_action( 'woocommerce_process_product_meta', 'wc_save_extra_product_fields' );
Code above works fine. So only having trouble when duplicating a product.
Any help appreciated.
Guido
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘No custom field variable when duplicating product’ is closed to new replies.