Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WC Appointment › How to override appointment product manager defaults?
- This topic has 5 replies, 2 voices, and was last updated 5 years ago by me.
- AuthorPosts
- November 24, 2019 at 3:23 am #93705meParticipant
Hi,
I’m trying to change a few default values in /views/wc_appointments/wcfmu-view-wcappointments-products-manage.php : 55-56
(I want to change the default value of $has_restricted_days and $restricted_days)
I tried template override but it doesn’t seem to work for this file, even though I already overridden a few other files in the same folder by placing them in /wcfm/wc_appointments under my child theme. But this file is not being overridden like the others, for some reason.
Another way would be to use filters to change the defaults, but there aren’t any filters provided for that.
Can you help me with one of those two methods so I don’t have to keep modifying your base code after every update?Thanks.
- November 26, 2019 at 3:42 pm #94043WCFM ForumMember
HI,
Well, these are possible using filter.
Please know me what default value you want to set, I will give you code accordingly!
Thank You
- November 26, 2019 at 4:07 pm #94056meParticipant
I’d like restricted days to be enabled by default, and set to weekdays, Monday to Friday.
This is what I put in the base code to achieve it:$has_restricted_days = 'yes'; $restricted_days = array( 1, 2, 3, 4, 5 );
would be awesome to use filters instead! Thanks in advance.
PS, don’t forget to answer my question from last week. Thanks. - December 4, 2019 at 12:09 am #95910meParticipant
Bump?
- December 7, 2019 at 12:54 pm #96409WCFM ForumMember
Please use this code for the purpose-
add_filter( 'wcfm_wcappointments_availability_fields', function( $avalability_fields, $product_id ) { if( !$product_id ) { if( isset( $avalability_fields['_wc_appointment_has_restricted_days'] ) ) { $avalability_fields['_wc_appointment_has_restricted_days']['dfvalue'] = 'yes'; } if( isset( $avalability_fields['_wc_appointment_restricted_days'] ) ) { $avalability_fields['_wc_appointment_restricted_days']['value'] = array(1,2,3,4,5); } } return $avalability_fields; }, 50, 2 );
Thank You
- December 11, 2019 at 6:03 pm #97042meParticipant
Thanks a lot!
- AuthorPosts
- The topic ‘How to override appointment product manager defaults?’ is closed to new replies.