Banner Logo

Be a part of the family: Connect, Receive Support,
Contribute, and Reap Abundant Rewards!

character limit

WCMp Core

Resolved
Viewing 7 reply threads
  • Author
    Posts
    • #123417
      erez
      Participant

      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 Length

      Screenshot attached .

    • #123420

      Hi @erez, our developer will check this on Monday, kindly provide them sometimes.

    • #123465

      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;
          }
      } );
      Copy

      By default, we set a character limit of 5. This is the basic code. Now you can change as per your requirement.
      Thanks

    • #123482
      erez
      Participant

      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 ?

    • #123512

      hi @erez , this is not a css.
      Hence, you need to add this code in function.php in your current theme.

    • #123560
      erez
      Participant

      Works like a charm, thanks

    • #123567

      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.

    • #125463
      erez
      Participant

      Please close this ticket

Viewing 7 reply threads

The topic ‘character limit’ is closed to new replies.