0

I am using Dokan to develop a multi Vendor store for a client, I have added two custom product fields but on will not save values (the product info) Screen shot.

''' add_action( 'dokan_new_product_added','save_add_product_meta', 10, 2 ); add_action( 'dokan_product_updated', 'save_add_product_meta', 10, 2 );

function save_add_product_meta($product_id, $postdata){

if ( ! dokan_is_user_seller( get_current_user_id() ) ) {
        return;
    }

    if ( ! empty( $postdata['new_field'] ) ) {
        update_post_meta( $product_id, 'new_field', $postdata['new_field'] );
   
}


if ( ! empty( $postdata['new_field_1'] ) ) {
        update_post_meta( $product_id, 'new_field_1', $postdata['new_field_1'] );
    }

} '''

  • Did you try the debug and print the `$postdata` to check what you get? and share your full code as well. how did you add those two fields to dokan vendor product page? – Bhautik Mar 23 '21 at 19:02
  • I have not tried a debug, I added the code using the snippets plugin to function.php, link to full code https://github.com/Data-Viu/dokan-funtions.php/blob/main/product. – Miles Bullock Mar 24 '21 at 10:55

0 Answers0