Support » Plugin: WC Duplicate Order » Duplicate Custom order fields

  • Hi,

    THe plugin is awsome. THe only issue is with custom fileds, which are not duplicated. You can see how it is done by “Duplicate Post” plugin by Enrico Battocchi https://bg.wordpress.org/plugins/duplicate-post/ . Actually their plugin doens’t work at all with WC, but only custom fields are duplicated correctly. You can stole the idea from these guys. 🙂

    10x

Viewing 1 replies (of 1 total)
  • Plugin Author Jamie Gill

    (@patchgill)

    Hi There,

    I have added a hook in here so you can hook in and add in your custom fields an this will be duplicated with each order. A simple example for your functions.php would be :-

    add_action(‘clone_custom_order_fields’, ‘clone_extra_fields’, 10, 2);

    function clone_extra_fields($order_id, $original_order_id) {

    update_post_meta( $order_id, ‘My_Field’, get_post_meta($original_order_id, ‘My_Field’, true));

    }

    Just change ‘my_field’ to your field name and it should be duplicated fine.

    Cheers
    J

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.