WCMp Core
-
AuthorPosts
-
-
June 19, 2021 at 6:57 PM #123417erezParticipant
Hi
I would like to add character limit in vendor dashboard when adding a product:
1- limit Product Title Length
2- limit Product short description LengthScreenshot attached .
-
June 19, 2021 at 10:19 PM #123420NerdySupportExpert MoumitaKeymaster
Hi @erez, our developer will check this on Monday, kindly provide them sometimes.
-
June 21, 2021 at 8:03 PM #123465Raju The Cool GuyKeymaster
Hi,
Here is the code —/** **required some wcmp product field **/ add_action( 'wcmp_before_post_update', function() { $required_product_description = isset( $_POST['product_excerpt'] ) ? $_POST['product_excerpt'] : ''; $post_title = isset( $_POST['post_title'] ) ? $_POST['post_title'] : ''; $product_short_description_number = 5; if(strlen($required_product_description) > $product_short_description_number || strlen($post_title) > $product_short_description_number ) { wc_add_notice( __('You have to add description and title within '. $product_short_description_number .' character ', 'dc-woocommerce-multi-vendor'), 'error' ); wp_redirect( apply_filters( 'wcmp_vendor_save_product_redirect_url', wcmp_get_vendor_dashboard_endpoint_url( get_wcmp_vendor_settings( 'wcmp_edit_product_endpoint', 'vendor', 'general', 'edit-product' ), $_POST['post_ID'] ) ) ); exit; } } );
CopyBy default, we set a character limit of 5. This is the basic code. Now you can change as per your requirement.
Thanks -
June 21, 2021 at 11:12 PM #123482erezParticipant
Hey thanks,
Unfortunately the code affects the display of the site on the front end.
I added the code to theme Global Custom CSS . Should I put it somewhere else ? -
June 22, 2021 at 1:54 PM #123512MVX Support NinjaKeymaster
hi @erez , this is not a css.
Hence, you need to add this code in function.php in your current theme. -
June 22, 2021 at 11:38 PM #123560erezParticipant
Works like a charm, thanks
-
June 23, 2021 at 9:03 AM #123567MVX Support NinjaKeymaster
You are welcome erez.
we are happy to help
We would love it if you shared your experience by giving us 5/5 review here : https://wordpress.org/support/plugin/dc-woocommerce-multi-vendor/reviews/#new-post
Seeing glowing reviews from existing customers makes others more comfortable knowing they’ll get the support they need should an issue with our services arise. -
July 26, 2021 at 9:01 PM #125463erezParticipant
Please close this ticket
-
-
AuthorPosts
The topic ‘character limit’ is closed to new replies.