diff --git a/includes/CatalogMode/Dashboard/Products.php b/includes/CatalogMode/Dashboard/Products.php index d5f4afaffe..bf84cf9d0e 100644 --- a/includes/CatalogMode/Dashboard/Products.php +++ b/includes/CatalogMode/Dashboard/Products.php @@ -30,6 +30,7 @@ public function __construct() { add_action( 'dokan_product_edit_after_options', [ $this, 'render_product_section' ], 99, 1 ); // save catalog mode section data add_action( 'dokan_product_updated', [ $this, 'save_catalog_mode_data' ], 13 ); + add_action( 'dokan_new_product_added', [ $this, 'save_catalog_mode_data' ], 13 ); } /** diff --git a/templates/products/edit-product-single.php b/templates/products/edit-product-single.php index 049cd14de0..c5e0a6d065 100755 --- a/templates/products/edit-product-single.php +++ b/templates/products/edit-product-single.php @@ -50,7 +50,14 @@ $product->set_name( $post_title ); $product->set_status( $post_status ); - $post_id = $product->save(); + $post_id = $product->save(); + wp_update_post( + [ + 'ID' => $post_id, + 'post_author' => dokan_get_current_user_id(), + ] + ); + $post = get_post( $post_id ); $from_shortcode = true; $new_product = true;