Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Groups & Staffs › Custom Product Type, capabilities
- This topic has 4 replies, 2 voices, and was last updated 3 years, 10 months ago by dominicanstrading.
- AuthorPosts
- June 8, 2020 at 9:24 am #139433dominicanstradingParticipant
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.
- June 8, 2020 at 12:53 pm #139486Sarmistha ChakrabortyKeymaster
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.
- June 9, 2020 at 5:43 pm #139904dominicanstradingParticipant
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!
- June 9, 2020 at 9:30 pm #139976Sarmistha ChakrabortyKeymaster
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.
- June 10, 2020 at 12:35 pm #140184dominicanstradingParticipant
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.
- AuthorPosts
- You must be logged in to reply to this topic.