Custom Product Type, capabilities

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!

Viewing 4 reply threads
  • Author
    Posts
    • #139433
      dominicanstrading
      Participant

      Dear support, i created a custom product type called “Ticket” in WCFM, then I tried this code for add capabilities to certain membership

      /** capabilities on for new product type Ticket **/
      add_filter( ‘wcfm_capability_settings_fields_product_types’, function( $pro_types, $capability_handler, $capability_manager_options ) {
      $ticket = ( isset( $capability_manager_options[‘ticket’] ) ) ? $capability_manager_options[‘ticket’] : ‘no’;
      $pro_types[‘ticket’] = array(‘label’ => __(‘Ticket’, ‘wc-frontend-manager’) , ‘name’ => $capability_handler.'[ticket]’,’type’ => ‘checkboxoffon’, ‘class’ => ‘wcfm-checkbox wcfm_ele’, ‘value’ => ‘yes’, ‘label_class’ => ‘wcfm_title checkbox_title’, ‘dfvalue’ => $ticket);
      return $pro_types;
      }, 50, 3 );

      This code add the capability switcher ON/OFF in the menu manager/capability but not complete the action in the product add form, i push OFF and the product is still visible in the product type drop down select.

      Please help.

    • #139486

      Hello,

      You need to add condition “Product type” options, Try this –

      add_filter('wcfm_product_types',function($producttyps){
      	global $WCFM, $WCFMu;	
      	$wcfm_capability_options = get_option( 'wcfm_capability_options');
      	$manage_customproducttype = ( isset( $wcfm_capability_options['ticket'] ) ) ? $wcfm_capability_options['ticket'] : 'no';
      	if( $manage_customproducttype == 'yes' ) {
      	  	unset($producttyps['ticket']);
      	  	/***** unset the ticket product type****/
      	} else {
      	  	
      	  	/**** keep the ticket product type****/
      	}  
      	return $producttyps;
      },50);

      Thanks.

    • #139904
      dominicanstrading
      Participant

      wow, work perfect! thank you very much,

      something I forgot to ask, please help me with this. I use FOOEVENTS for this new Product Type “Ticket” how I limit the “Event” tab show only for this “Ticket” product type when is selected in product type dropdown?, also mark “Is this product an event?: YES” by default? please give me a solution for “Ticket” and the possibility to add another product type with this condition in case I need it.

      a last question, wcfm ultimate has compatibility with FOOEVENTS EXPRESS CHECK-IN addon?

      Have a nice day and thank you for your great support!

    • #139976

      Hello,

      To show Event tab for only product type “ticket”, use this below code –

      add_filter('wcfm_pm_block_class_fooevents',function($cls){
      	global $WCFM, $WCFMu;
      	$cls = 'non-simple non-variable ticket'; //replace ticket with your required custom product type
      	return $cls;
      },10);

      mark “Is this product an event?: YES” by default?
      >>By-default we don’t have this feature, It will need some customization,
      Add this code in your functions.php –

      add_action('begin_wcfm_products_manage_form',function(){
      	global $wp, $WCFM;
      	$WooCommerceEventsEvent = 'not-select';
      	$product_id = 0;	
      	if( isset( $wp->query_vars['wcfm-products-manage'] ) && !empty( $wp->query_vars['wcfm-products-manage'] ) ) {		
      		$product = wc_get_product( $wp->query_vars['wcfm-products-manage'] );		
      		if( !is_a( $product, 'WC_Product' ) ) {
      			wcfm_restriction_message_show( "Invalid Product" );
      			return;
      		}			
      		// Fetching Product Data
      		if($product && !empty($product)) {
      			$product_id = $wp->query_vars['wcfm-products-manage'];
      			$WooCommerceEventsEvent = get_post_meta($product_id, 'WooCommerceEventsEvent', true);;
      		}
      	}
      	 ?>
      	<input type="hidden" id="checkeventload" value="<?php echo $WooCommerceEventsEvent; ?>">
       <?php		
       			
      });

      And add below js code in your theme’s js file –

      jQuery(document).ready(function ($) {
      if( $('#WooCommerceEventsEvent').length > 0 ) {
          if ($('#checkeventload').val() == 'not-select') {
            $('select#WooCommerceEventsEvent option[value="Event"]').attr("selected",true);
            $('select#WooCommerceEventsEvent option[value="Event"]').change();
          }
        }
      });

      wcfm ultimate has compatibility with FOOEVENTS EXPRESS CHECK-IN addon?
      >>Yes, https://wclovers.com/forums/topic/use-the-fooevent-full-house-bundle-plugin/

      Thanks.

    • #140184
      dominicanstrading
      Participant

      Thank you very much for this powerful information.

      Regarding Fooevents Express check-in addon, in the post you are refering here https://wclovers.com/forums/topic/use-the-fooevent-full-house-bundle-plugin/ your support explain that “fooevents express check-in will be added soon and working on it” i installed the addons but not show the express check-in inside wcfm, i’m missing something? need to add the endpoint in menu? or addon not integrated yet?

      Thanks for help.

Viewing 4 reply threads
  • You must be logged in to reply to this topic.