Adding custom field(s) to product-edit.php requires editing wc-funcitons.php too

  • Home
  • Forums
  • Dokan
  • Adding custom field(s) to product-edit.php requires editing wc-funcitons.php too
This topic contains 2 reply and 3 voices, and was last updated by Sk 9 years, 10 months ago
Viewing 2 Posts - 1 through 2 (of 2 total)
Author Posts
April 26, 2014 at 2:00 am 19424
Sk So I want to add some custom fields to the product-edit page, but doing this requires me to also edit the wc-functions.php file because of the function "dokan_process_product_meta". I had to add my fields inside that function in order for them to update properly. Is there a better way to do this? I'm using a child theme and do not want to have to worry about overwriting the wc-functions.php file when I upgrade?
May 5, 2014 at 4:55 pm 19918
Mohd Ghufran Mohd Ghufran

I also need an update on this.Please response

May 11, 2014 at 1:38 pm 20274
Sk Sk

hello Simon

sorry for late response.

create a new function file with necessary changes in your child theme.

find includes() function in dokan/functions.php file.

replace wc-functions.php with your file.

if ( is_child_theme() && file_exists( get_stylesheet_directory() . '/your-path/your-file.php' ) ) {
     require_once get_stylesheet_directory() . '/your-path/your-file.php';
 } else {
     require_once $inc_dir . 'wc-functions.php';
 }

or you could easily use an add_action to your functions.php page

there is a do_action in wc-functions.php page
do_action( 'dokan_process_product_meta', $post_id );
this action returns a parameter $post_id. you could add your custom meta by this action.

thank you.

Viewing 2 Posts - 1 through 2 (of 2 total)