wordpress - woocommerce_order_itemmeta value empty for sub order -


in order, order item meta table values 0. please check screenshot.

the issue related dokan plugin. dokan create suborder automatically based on seller.

added following code inside wp-contents/plugins/[dokan]/includes/wc-functions.php

    function dokan_get_order_item_meta_map() {     return apply_filters( 'dokan_get_order_item_meta_keymap', array(         'product_id'   => '_product_id',         'variation_id' => '_variation_id',         'quantity'     => '_qty',         'tax_class'    => '_tax_class',         'subtotal'     => '_line_subtotal',         'subtotal_tax' => '_line_subtotal_tax',         'total'        => '_line_total',         'total_tax'    => '_line_tax',         'taxes'        => '_line_tax_data'     ) ); } 

also modifyed function function dokan_create_seller_order( $parent_order, $seller_id, $seller_products )

and changed section after if ($itemid){

if ( $item_id ) {                 $item_meta_data = $item->get_data();                 $meta_key_map = dokan_get_order_item_meta_map();                 foreach ( $item->get_extra_data_keys() $meta_key ) {                     wc_add_order_item_meta( $item_id, $meta_key_map[$meta_key], $item_meta_data[$meta_key] );                 } 

now product meta data save correspon


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -