Home Forums WC Vendors Pro Support Setting a limit to product title characters

NOTICE: We've Moved to a Ticket System for Support

As of August 31, 2017 (12am EST) our support forums will be retired (read-only), and we will be moving to a support ticket system.  This will allow us to better organize and answer support requests, and provide a more personalized experience as we assist our customers.

For the time being, we will leave our forums open for reading and learning while we work on creating a more robust Knowledge Base for everyone to use.

If you are a WC Vendors Pro customer please open a support ticket here. 

If you are a WC Vendors user please open a support ticket on the Wordpress.org forums.

The information on this forum is outdated and in most instances no longer relevant. Please be sure to check our documentation for the most up to date information.

https://docs.wcvendors.com/

Thank you to all of our customers!

 

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #59184
    Leland
    Participant

    I’d like to set a character limit to product titles. How can I do that? Thanks.

    #59190
    Anna
    Member

    Leland,
    Sure- use this Gist. Change the 200 to whatever you wish the product title length character limit to be set to.
    The error message can also be changed to warn vendors to use less than “x” characters int he title. This would go in your theme/child theme functions.php file:
    https://gist.github.com/fervous/10c51c81f7a37f2c30621278a406e11d

    #59822
    Mircea
    Participant

    I would like to put also that the category is required, there are customers who forget to put category.
    Thanks

    #59897
    Anna
    Member

    @memorex13
    In our upcoming Pro version 1.4.0, you will have the option to make Categories (as well as other fields on the product form) required.
    This will be released in early April.

    #60582
    Leland
    Participant

    Perfect! Thank you, Anna! Is there a code available to limit the characters in the shop description as well?

    #60650
    Anna
    Member

    Leland,
    I can show you how to limit the OUTPUT of the store description…
    1. Modify the store-header.php template, found here: wp-content/plugins/wcvendors-pro/templates/store/store-header.php
    2. Move it to:
    wp-content/themes/your-theme-or-child-theme/wc-vendors/store/store-header.php

    3. Around line 112, you will see this:
    <p><?php echo $vendor_meta['pv_shop_description']; ?></p>

    You need to change it to this… and change the 100 to whatever number of characters you wish to limit the output to:
    <p><?php echo substr($vendor_meta['pv_shop_description'], 0,100). "..."; ?></p>

    This should limit the store description text output in the store header/store banner area to the specified number of characters (in this case, 100 characters).

    https://gist.github.com/fervous/51c83cb93a96e7f38fc13eff47082c50#file-store-header-php

    #60952
    Inga
    Participant

    Thank you for the reply. I edited the code on line 112 as you suggested and made the limit to 80 but the descriptions are still appearing long. After I re-uploaded the edited php file, should it have made old descriptions shorter? Or does the change only apply to new shop descriptions? Thank you!

    #73172
    Jaypreet Thukral
    Participant

    @fervous

    “In our upcoming Pro version 1.4.0, you will have the option to make Categories (as well as other fields on the product form) required.
    This will be released in early April.”

    is this feature released ?
    Thanks

Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘WC Vendors Pro Support’ is closed to new topics and replies.