How to override appointment product manager defaults?

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

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.
Viewing 5 reply threads
  • Author
    Posts
    • #93705
      me
      Participant

      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.

    • #94043
      WCFM Forum
      Member

      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

    • #94056
      me
      Participant

      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.

    • #95910
      me
      Participant

      Bump?

    • #96409
      WCFM Forum
      Member

      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

    • #97042
      me
      Participant

      Thanks a lot!

Viewing 5 reply threads
  • The topic ‘How to override appointment product manager defaults?’ is closed to new replies.