Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WC Bookings › Custom form validation ?
- This topic has 2 replies, 2 voices, and was last updated 5 years, 12 months ago by WCFM Forum.
Viewing 2 reply threads
- AuthorPosts
- April 5, 2018 at 1:12 pm #21301ConnorGuest
Hi,
At the moment it only seems to *REQUIRE a title to add a product.
All custom fields added via the WCFM settings can be make required instead of optional.
Is there a way to make other fields required such as a category, short description etc?
- April 6, 2018 at 6:08 am #21333WCFM ForumKeymaster
Hi,
Yes you may definitely do this.
Here is a sample code for you. It set shipping fields required –
function wcfm_custom_product_manage_fields_shipping( $shipping_fields, $product_id ) { global $WCFM; if( isset( $shipping_fields['weight'] ) ) { $shipping_fields['weight']['custom_attributes'] = array( 'required' => 1 ); } if( isset( $shipping_fields['length'] ) ) { $shipping_fields['length']['custom_attributes'] = array( 'required' => 1 ); } if( isset( $shipping_fields['width'] ) ) { $shipping_fields['width']['custom_attributes'] = array( 'required' => 1 ); } if( isset( $shipping_fields['height'] ) ) { $shipping_fields['height']['custom_attributes'] = array( 'required' => 1 ); } if( isset( $shipping_fields['shipping_class'] ) ) { $shipping_fields['shipping_class']['custom_attributes'] = array( 'required' => 1 ); } return $shipping_fields; } add_filter( 'wcfm_product_manage_fields_shipping', 'wcfm_custom_product_manage_fields_shipping', 50, 2 );
Hope this will help full for you to do the same for others.
Thank You
- April 13, 2018 at 8:31 am #21724WCFM ForumKeymaster
Hi,
You don’t need to use this code any more.
You are now allowed to set such validation from WCfM Admin Settings -> Product Custom Validation
Thank You
- AuthorPosts
Viewing 2 reply threads
- The topic ‘Custom form validation ?’ is closed to new replies.