Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Ultimate › Downloadable not saving
- This topic has 15 replies, 2 voices, and was last updated 4 years, 8 months ago by Sushobhan.
- AuthorPosts
- February 26, 2020 at 7:06 pm #108918SSCParticipant
Hello,
When activating ‘downloadable’ on a custom product type, it does not save the value.
I have tested with the ‘simple’ product type, and it saves the values.
I have also tested the custom product type and downloadable in the admin dashboard, and that works fine; but when trying from the vendor dashboard, it does not work. - February 27, 2020 at 12:24 pm #109007SushobhanKeymaster
Hello,
Thanks for getting in touch.
By ‘custom product type’ what product type do you mean and it is coming from which plugin?
Let me know.
Thanks! - February 27, 2020 at 4:04 pm #109028SSCParticipant
It is a product type which I created. I have also found another problem. I think they might be related. Did a hook recently change?
Now, I can turn off the capability for that product type, but I can not turn it back on. It was working fine earlier.add_action( 'init', 'register_product_Custom_Type' ); function register_product_Custom Type() { class WC_Product_Custom_Type extends WC_Product { public function __construct( $product ) { $this->product_type = 'Custom Type'; parent::__construct( $product ); } } } add_filter( 'product_type_selector', 'add_product_Custom_Type' ); add_filter( 'wcfm_product_types', 'add_product_Custom_Type', 50 ); function add_mog_product_type( $types ){ $types[ 'Custom Type' ] = __( 'Custom Type', 'custom_product' ); return $types; } add_filter( 'wcfm_capability_settings_fields_product_types', function( $product_types, $wcfm_capability_options = array() ) { global $WCFM; $wcfm_capability_options = get_option( 'wcfm_capability_options', array() ); $CustomType = ( isset( $wcfm_capability_options['Custom Type'] ) ) ? $wcfm_capability_options['Custom Type'] : 'no'; $product_types['Custom Type'] = array('label' => __('Custom Type', 'wc-frontend-manager') , 'name' => 'wcfm_capability_options[Custom Type]','type' => 'checkboxoffon', 'class' => 'wcfm-checkbox wcfm_ele', 'value' => 'yes', 'label_class' => 'wcfm_title checkbox_title', 'dfvalue' => $CustomType ); return $product_types; }, 60, 3 ); function _allow_custom_product_types( $product_types, $wcfm_capability_options = array() ) { global $WCFM; $wcfm_capability_options = get_option( 'wcfm_capability_options', array() ); $CustomType = ( isset( $wcfm_capability_options['CustomType'] ) ) ? $wcfm_capability_options['CustomType'] : 'no'; if( $CustomType == 'yes' ) unset( $product_types[ 'Custom Type' ] ); return $product_types; } add_filter( 'wcfm_product_types', '_allow_custom_product_types', 700 ); function _products_manage_meta_save_offer_type( $new_product_id, $wcfm_products_manage_form_data ) { global $WCFM; if($wcfm_products_manage_form_data['product_type'] == 'Custom Type') { update_post_meta( $new_product_id, 'offer_type_filter', esc_attr( $wcfm_products_manage_form_data['product_type'] ) ); } else{} } add_action( 'after_wcfm_products_manage_meta_save', '_products_manage_meta_save_offer_type', 50, 2 );
- February 27, 2020 at 6:32 pm #109045SSCParticipant
I have discovered that the problems are separate.
The capabilities for the custom post types are not being saved as active only with Groups & Staffs add-on activated.
The download type not saving when creating a product is always happening, even on a fresh install. - February 27, 2020 at 8:28 pm #109050SSCParticipant
The capabilities problem is coming from ‘wcfmgs-view-shop-manager-capability’ and ‘wcfmgs-view-shop-staff-capability’.
I tried adding wcfm_shop_manager_capability_options and wcfm_shop_staff_capability_options hooks to the capability settings but I don’t think I’m doing it properly.add_filter( 'wcfm_capability_settings_fields_product_types', function( $product_types, $wcfm_shop_manager_capability_options = array() ) { global $WCFM, $WCFMu; $wcfm_shop_manager_capability_options = get_option( 'wcfm_shop_manager_capability_options', array() ); $Currency = ( isset( $wcfm_shop_manager_capability_options['Currency'] ) ) ? $wcfm_shop_manager_capability_options['Currency'] : 'no'; $Accounts = ( isset( $wcfm_shop_manager_capability_options['Accounts'] ) ) ? $wcfm_shop_manager_capability_options['Accounts'] : 'no'; $CDKey = ( isset( $wcfm_shop_manager_capability_options['CDKey'] ) ) ? $wcfm_shop_manager_capability_options['CDKey'] : 'no'; $Powerleveling = ( isset( $wcfm_shop_manager_capability_options['Powerleveling'] ) ) ? $wcfm_shop_manager_capability_options['Powerleveling'] : 'no'; $Items = ( isset( $wcfm_shop_manager_capability_options['Items'] ) ) ? $wcfm_shop_manager_capability_options['Items'] : 'no'; $product_types['Currency'] = array('label' => __('Currency', 'wc-frontend-manager') , 'name' => 'wcfm_shop_manager_capability_options[Currency]','type' => 'checkboxoffon', 'class' => 'wcfm-checkbox wcfm_ele', 'value' => 'yes', 'label_class' => 'wcfm_title checkbox_title', 'dfvalue' => $Currency ); $product_types['Accounts'] = array('label' => __('Accounts', 'wc-frontend-manager') , 'name' => 'wcfm_shop_manager_capability_options[Accounts]','type' => 'checkboxoffon', 'class' => 'wcfm-checkbox wcfm_ele', 'value' => 'yes', 'label_class' => 'wcfm_title checkbox_title', 'dfvalue' => $Accounts ); $product_types['CD Key'] = array('label' => __('CD Key', 'wc-frontend-manager') , 'name' => 'wcfm_shop_manager_capability_options[CD Key]','type' => 'checkboxoffon', 'class' => 'wcfm-checkbox wcfm_ele', 'value' => 'yes', 'label_class' => 'wcfm_title checkbox_title', 'dfvalue' => $CDKey ); $product_types['Powerleveling'] = array('label' => __('Powerleveling', 'wc-frontend-manager') , 'name' => 'wcfm_shop_manager_capability_options[Powerleveling]','type' => 'checkboxoffon', 'class' => 'wcfm-checkbox wcfm_ele', 'value' => 'yes', 'label_class' => 'wcfm_title checkbox_title', 'dfvalue' => $Powerleveling ); $product_types['Items'] = array('label' => __('Items', 'wc-frontend-manager') , 'name' => 'wcfm_shop_manager_capability_options[Items]','type' => 'checkboxoffon', 'class' => 'wcfm-checkbox wcfm_ele', 'value' => 'yes', 'label_class' => 'wcfm_title checkbox_title', 'dfvalue' => $Items ); return $product_types; }, 60, 3 ); function _allow_custom_product_types_manager( $product_types, $wcfm_shop_manager_capability_options = array() ) { global $WCFM, $WCFMu; $wcfm_shop_manager_capability_options = get_option( 'wcfm_shop_manager_capability_options', array() ); $Currency = ( isset( $wcfm_shop_manager_capability_options['Currency'] ) ) ? $wcfm_shop_manager_capability_options['Currency'] : 'no'; $Accounts = ( isset( $wcfm_shop_manager_capability_options['Accounts'] ) ) ? $wcfm_shop_manager_capability_options['Accounts'] : 'no'; $CDKey = ( isset( $wcfm_shop_manager_capability_options['CDKey'] ) ) ? $wcfm_shop_manager_capability_options['CDKey'] : 'no'; $Powerleveling = ( isset( $wcfm_shop_manager_capability_options['Powerleveling'] ) ) ? $wcfm_shop_manager_capability_options['Powerleveling'] : 'no'; $Items = ( isset( $wcfm_shop_manager_capability_options['Items'] ) ) ? $wcfm_shop_manager_capability_options['Items'] : 'no'; if( $Currency == 'yes' && !current_user_can( 'administrator' ) ) unset( $product_types[ 'Currency' ] ); elseif( $Accounts == 'yes' && !current_user_can( 'administrator' ) ) unset( $product_types[ 'Accounts' ] ); elseif( $CDKey == 'yes' && !current_user_can( 'administrator' ) ) unset( $product_types[ 'CD Key' ] ); elseif( $Powerleveling == 'yes' && !current_user_can( 'administrator' ) ) unset( $product_types[ 'Powerleveling' ] ); elseif($Items == 'yes' && !current_user_can('administrator') ) unset($product_types[ 'Items' ]); return $product_types; } add_filter( 'wcfm_product_types', '_allow_custom_product_types_manager', 700 );
- March 1, 2020 at 4:02 pm #109412SushobhanKeymaster
Hello,
There are few problem with this code.wcfm_capability_settings_fields_product_types
filter passes 3 arguments$product_types, $handler = 'wcfm_capability_options', $wcfm_capability_options = array()
. For shop managers the $handler value will be ‘wcfm_shop_manager_capability_options’. So if your function accepts 3 arguments, instead of 2, you will get the capability options array from there and there is no need to call get_option() for that.wcfm_product_types
filter on the other hand passes only one argument $product_types array. If you want to check this for shop managers you should check the current user type at top of your function. Also the lastif-elseif
block is wrong. It must be allif
checks.
Thanks!
- March 1, 2020 at 3:29 pm #109410SushobhanKeymaster
Hi,
Your code for adding a custom type is not fully complete and it doesn’t have support for downloadable and virtual types. You can check that from backend, where if you choose your ‘Custom Type’ both the download and virtual option got disappeared.
But, as you are using WCFM frontend, you were able to send downloadable related data. Right now downloadable data is getting saved. But you need to add two more functions to retrieve that data. Please note, here I use product type name as ‘custom_type’ which is preferred over ‘Custom Type’ (array key name).function custom_type_downloadable_support($fields, $product_id, $product_type) { if($product_type == 'custom_type') { $is_downloadable = ( get_post_meta( $product_id, '_downloadable', true) == 'yes' ) ? 'enable' : ''; $fields["is_downloadable"]['dfvalue'] = $is_downloadable; } return $fields; } add_filter( 'wcfm_product_manage_fields_general', 'custom_type_downloadable_support', 10, 3 ); function custom_type_downloadable_tab_data($fields, $product_id, $product_type ) { if($product_type == 'custom_type') { $is_downloadable = ( get_post_meta( $product_id, '_downloadable', true) == 'yes' ) ? 'enable' : ''; if($is_downloadable == 'enable') { $downloadable_files = (array) get_post_meta( $product_id, '_downloadable_files', true); $download_limit = ( -1 == get_post_meta( $product_id, '_download_limit', true) ) ? '' : get_post_meta( $product_id, '_download_limit', true); $download_expiry = ( -1 == get_post_meta( $product_id, '_download_expiry', true) ) ? '' : get_post_meta( $product_id, '_download_expiry', true); } $fields["downloadable_files"]['value'] = $downloadable_files; $fields["download_limit"]['value'] = $download_limit; $fields["download_expiry"]['value'] = $download_expiry; } return $fields; } add_filter( 'wcfm_product_fields_downloadable', 'custom_type_downloadable_tab_data', 10, 3 );
Thanks
- March 1, 2020 at 4:30 pm #109416SSCParticipant
Thank you for the help, I have solved the downloadable problems with that snippet, but I am a little confused on the capability issues still.
I added$handler = 'wcfm_capability_options',
is the handler suppose to be called somewhere? Do I need to make multiple functions for each user type (i.e. manager, staff, default)?
Currently, I can change the options on the ‘vendor’ level only, but it does not save. The other capability levels do not allow the option to be selected at all. - March 4, 2020 at 1:16 pm #109852SushobhanKeymaster
Hello,
Kindly provide me your code snippet to check. The variable $handler can be used to check for user type. For shop managers the value of $handler is ‘wcfm_shop_manager_capability_options’. So you can add a check on the value if you want to make these capability available for a particular user type.
Thanks! - March 4, 2020 at 2:50 pm #109915SSCParticipant
I did get this solved with the following snippet
add_filter( 'wcfm_capability_settings_fields_product_types', function( $product_types, $handler, $wcfm_capability_options = array() ) { global $WCFM; $CustomType = ( isset( $wcfm_capability_options['CustomType'] ) ) ? $wcfm_capability_options['CustomType'] : 'no'; $product_types['CustomType'] = array('label' => __('CustomType', 'wc-frontend-manager') , 'name' => $handler.'[CustomType]','type' => 'checkboxoffon', 'class' => 'wcfm-checkbox wcfm_ele', 'value' => 'yes', 'label_class' => 'wcfm_title checkbox_title', 'dfvalue' => $CustomType); return $product_types; }, 60, 3 );
Though, I am still experiencing some problems. All the capabilities are saving, but they are not being respected. With the capability turned off, the vendor is still able to select that product type when creating a product.
function _allow_custom_product_types_manager( $product_types, $wcfm_capability_options = array() ) { global $WCFM; $CustomType = ( isset( $wcfm_capability_options['CustomType'] ) ) ? $wcfm_capability_options['CustomType'] : 'no'; if( $CustomType == 'yes' && !current_user_can( 'administrator' ) ) unset( $product_types[ 'CustomType' ] ); return $product_types; } add_filter( 'wcfm_product_types', '_allow_custom_product_types_manager', 700 );
I was suggested to change it to the below snippet, but that does not work either.
add_filter( 'wcfm_allowed_product_types', function( $product_types, $wcfm_capability_options ) { $CustomType = ( isset( $wcfm_capability_options['CustomType'] ) ) ? $wcfm_capability_options['CustomType'] : 'no'; if( $CustomType == 'yes' ) unset( $product_types[ 'CustomType' ] ); return $product_types; }, 50, 2 );
- March 4, 2020 at 2:51 pm #109917SSCParticipant
&& !current_user_can( 'administrator' )
Is normally removed, I just added that to do a test and forgot to remove it here. - March 4, 2020 at 6:52 pm #109973SushobhanKeymaster
Hello,
Please use the following snippet. Give special attention to ‘wcfm_capability_settings_fields_product_types’ filter and ‘_allow_custom_product_types’ function to see why your code was not working.function register_product_Custom_Type() { class WC_Product_Custom_Type extends WC_Product { public function __construct( $product ) { $this->product_type = 'custom_type'; parent::__construct( $product ); } } } add_action( 'init', 'register_product_Custom_Type' ); function add_product_Custom_Type( $types ) { $types['custom_type'] = __( 'Custom Type', 'custom_product' ); return $types; } add_filter( 'product_type_selector', 'add_product_Custom_Type' ); add_filter( 'wcfm_product_types', 'add_product_Custom_Type', 50 ); add_filter( 'wcfm_capability_settings_fields_product_types', function( $product_types, $handler, $wcfm_capability_options = array() ) { $custom_type = ( isset( $wcfm_capability_options['custom_type'] ) ) ? $wcfm_capability_options['custom_type'] : 'no'; $product_types['custom_type'] = array( 'label' => __( 'Custom Type', 'wc-frontend-manager' ), 'name' => $handler . '[custom_type]', 'type' => 'checkboxoffon', 'class' => 'wcfm-checkbox wcfm_ele', 'value' => 'yes', 'label_class' => 'wcfm_title checkbox_title', 'dfvalue' => $custom_type ); return $product_types; }, 60, 3 ); function _allow_custom_product_types( $product_types ) { $wcfm_capability_options = array(); if(wcfm_is_vendor()) { $wcfm_capability_options = get_option( 'wcfm_capability_options', array() ); } elseif(wcfm_is_manager()) { $wcfm_capability_options = get_option( 'wcfm_shop_manager_capability_options', array() ); } elseif(wcfm_is_staff()) { $wcfm_capability_options = get_option( 'wcfm_shop_staff_capability_options', array() ); } $custom_type = ( isset( $wcfm_capability_options['custom_type'] ) ) ? $wcfm_capability_options['custom_type'] : 'no'; if ( $custom_type == 'yes' && !current_user_can( 'administrator' ) ) unset( $product_types['custom_type'] ); return $product_types; } add_filter( 'wcfm_product_types', '_allow_custom_product_types', 700 ); function _products_manage_meta_save_offer_type( $new_product_id, $wcfm_products_manage_form_data ) { global $WCFM; if ( $wcfm_products_manage_form_data['product_type'] == 'custom_type' ) { update_post_meta( $new_product_id, 'offer_type_filter', esc_attr( $wcfm_products_manage_form_data['product_type'] ) ); } else { } } add_action( 'after_wcfm_products_manage_meta_save', '_products_manage_meta_save_offer_type', 50, 2 ); function custom_type_downloadable_support( $fields, $product_id, $product_type ) { if ( $product_type == 'custom_type' ) { $is_downloadable = ( get_post_meta( $product_id, '_downloadable', true ) == 'yes' ) ? 'enable' : ''; $fields["is_downloadable"]['dfvalue'] = $is_downloadable; } return $fields; } add_filter( 'wcfm_product_manage_fields_general', 'custom_type_downloadable_support', 10, 3 ); function custom_type_downloadable_tab_data( $fields, $product_id, $product_type ) { if ( $product_type == 'custom_type' ) { $is_downloadable = ( get_post_meta( $product_id, '_downloadable', true ) == 'yes' ) ? 'enable' : ''; if ( $is_downloadable == 'enable' ) { $downloadable_files = (array) get_post_meta( $product_id, '_downloadable_files', true ); $download_limit = ( -1 == get_post_meta( $product_id, '_download_limit', true ) ) ? '' : get_post_meta( $product_id, '_download_limit', true ); $download_expiry = ( -1 == get_post_meta( $product_id, '_download_expiry', true ) ) ? '' : get_post_meta( $product_id, '_download_expiry', true ); } $fields["downloadable_files"]['value'] = $downloadable_files; $fields["download_limit"]['value'] = $download_limit; $fields["download_expiry"]['value'] = $download_expiry; } return $fields; } add_filter( 'wcfm_product_fields_downloadable', 'custom_type_downloadable_tab_data', 10, 3 );
Thanks!
- March 4, 2020 at 9:40 pm #110008SSCParticipant
The if statements in
_allow_custom_product_types_manager
did fix the issue with most capabilities, but I am still having a problem with group capabilities when the group is linked to a membership. The only thing I was able to find that came close to those hooks were_wcfm_vendor_group
and_group_capability_options
but that didn’t work. - March 6, 2020 at 2:14 pm #110235SushobhanKeymaster
Hello,
Replace your existing _allow_custom_product_types function with the following code snippet-function get_group_capablity( $userid = '' ) { if ( ! is_user_logged_in() ) return false; if ( ! $userid ) $userid = get_current_user_id(); $wcfm_vendor_groups = get_user_meta( $userid, '_wcfm_vendor_group', true ); if ( $wcfm_vendor_groups && is_array( $wcfm_vendor_groups ) && ! empty( array_filter( $wcfm_vendor_groups ) ) ) { $group_capability_options = array(); foreach ( $wcfm_vendor_groups as $wcfm_vendor_group ) { if ( $wcfm_vendor_group ) { $group_capability_options = array_merge( $group_capability_options, (array) get_post_meta( $wcfm_vendor_group, '_group_capability_options', true ) ); } } return $group_capability_options; } return false; } function _allow_custom_product_types( $product_types ) { $wcfm_capability_options = get_group_capablity(); if ( ! $wcfm_capability_options ) { if ( wcfm_is_vendor() ) { $wcfm_capability_options = get_option( 'wcfm_capability_options', array() ); } elseif ( wcfm_is_manager() ) { $wcfm_capability_options = get_option( 'wcfm_shop_manager_capability_options', array() ); } elseif ( wcfm_is_staff() ) { $wcfm_capability_options = get_option( 'wcfm_shop_staff_capability_options', array() ); } else { $wcfm_capability_options = array(); } } $custom_type = ( isset( $wcfm_capability_options['custom_type'] ) ) ? $wcfm_capability_options['custom_type'] : 'no'; if ( $custom_type == 'yes' && ! current_user_can( 'administrator' ) ) unset( $product_types['custom_type'] ); return $product_types; }
Thanks!
- March 6, 2020 at 4:42 pm #110268SSCParticipant
It seems all the logic is there and that it should work, but it sadly does not. I tried moving things around a few different ways, but that product type still always showed for the vendor when it should be disabled. I ended up just using a purchase check, which would check if they purchased that membership, but this would be a issue doing it this way when manually adding a vendor to the group.
- March 9, 2020 at 1:32 pm #110692SushobhanKeymaster
Hello,
in my local setup the code is working fine. I’m sending the full code here, kindly comment out your all existing code and use the following-function register_product_Custom_Type() { class WC_Product_Custom_Type extends WC_Product { public function __construct( $product ) { $this->product_type = 'custom_type'; parent::__construct( $product ); } } } add_action( 'init', 'register_product_Custom_Type' ); function add_product_Custom_Type( $types ) { $types['custom_type'] = __( 'Custom Type', 'custom_product' ); return $types; } add_filter( 'product_type_selector', 'add_product_Custom_Type' ); add_filter( 'wcfm_product_types', 'add_product_Custom_Type', 50 ); add_filter( 'wcfm_capability_settings_fields_product_types', function( $product_types, $handler, $wcfm_capability_options = array() ) { $custom_type = ( isset( $wcfm_capability_options['custom_type'] ) ) ? $wcfm_capability_options['custom_type'] : 'no'; $product_types['custom_type'] = array( 'label' => __( 'Custom Type', 'wc-frontend-manager' ), 'name' => $handler . '[custom_type]', 'type' => 'checkboxoffon', 'class' => 'wcfm-checkbox wcfm_ele', 'value' => 'yes', 'label_class' => 'wcfm_title checkbox_title', 'dfvalue' => $custom_type ); return $product_types; }, 60, 3 ); function get_group_capablity( $userid = '' ) { if ( ! is_user_logged_in() ) return false; if ( ! $userid ) $userid = get_current_user_id(); $wcfm_vendor_groups = get_user_meta( $userid, '_wcfm_vendor_group', true ); if ( $wcfm_vendor_groups && is_array( $wcfm_vendor_groups ) && ! empty( array_filter( $wcfm_vendor_groups ) ) ) { $group_capability_options = array(); foreach ( $wcfm_vendor_groups as $wcfm_vendor_group ) { if ( $wcfm_vendor_group ) { $group_capability_options = array_merge( $group_capability_options, (array) get_post_meta( $wcfm_vendor_group, '_group_capability_options', true ) ); } } return $group_capability_options; } return false; } function _allow_custom_product_types( $product_types ) { $wcfm_capability_options = get_group_capablity(); if ( ! $wcfm_capability_options ) { if ( wcfm_is_vendor() ) { $wcfm_capability_options = get_option( 'wcfm_capability_options', array() ); } elseif ( wcfm_is_manager() ) { $wcfm_capability_options = get_option( 'wcfm_shop_manager_capability_options', array() ); } elseif ( wcfm_is_staff() ) { $wcfm_capability_options = get_option( 'wcfm_shop_staff_capability_options', array() ); } else { $wcfm_capability_options = array(); } } $custom_type = ( isset( $wcfm_capability_options['custom_type'] ) ) ? $wcfm_capability_options['custom_type'] : 'no'; if ( $custom_type == 'yes' && ! current_user_can( 'administrator' ) ) unset( $product_types['custom_type'] ); return $product_types; } add_filter( 'wcfm_product_types', '_allow_custom_product_types', 700 ); function _products_manage_meta_save_offer_type( $new_product_id, $wcfm_products_manage_form_data ) { global $WCFM; if ( $wcfm_products_manage_form_data['product_type'] == 'custom_type' ) { update_post_meta( $new_product_id, 'offer_type_filter', esc_attr( $wcfm_products_manage_form_data['product_type'] ) ); } else { } } add_action( 'after_wcfm_products_manage_meta_save', '_products_manage_meta_save_offer_type', 50, 2 ); function custom_type_downloadable_support( $fields, $product_id, $product_type ) { if ( $product_type == 'custom_type' ) { $is_downloadable = ( get_post_meta( $product_id, '_downloadable', true ) == 'yes' ) ? 'enable' : ''; $fields["is_downloadable"]['dfvalue'] = $is_downloadable; } return $fields; } add_filter( 'wcfm_product_manage_fields_general', 'custom_type_downloadable_support', 10, 3 ); function custom_type_downloadable_tab_data( $fields, $product_id, $product_type ) { if ( $product_type == 'custom_type' ) { $is_downloadable = ( get_post_meta( $product_id, '_downloadable', true ) == 'yes' ) ? 'enable' : ''; if ( $is_downloadable == 'enable' ) { $downloadable_files = (array) get_post_meta( $product_id, '_downloadable_files', true ); $download_limit = ( -1 == get_post_meta( $product_id, '_download_limit', true ) ) ? '' : get_post_meta( $product_id, '_download_limit', true ); $download_expiry = ( -1 == get_post_meta( $product_id, '_download_expiry', true ) ) ? '' : get_post_meta( $product_id, '_download_expiry', true ); } $fields["downloadable_files"]['value'] = $downloadable_files; $fields["download_limit"]['value'] = $download_limit; $fields["download_expiry"]['value'] = $download_expiry; } return $fields; } add_filter( 'wcfm_product_fields_downloadable', 'custom_type_downloadable_tab_data', 10, 3 );
Let me know how it goes.
Thanks!
- AuthorPosts
- You must be logged in to reply to this topic.