product-attribute-slug-is-too-long-28-characters-max

Question

Google did not fix my problem so..

Anyone here know how to increase the character limit for woocommerce product attribute slug, default it has a limit of 28 characters (max 32 in database) i need max 40.(tried to increase to max 128).

I’m testing a local site where product information comes from imported xml files, sometimes certain attribute names are just longer than 28 characters..

Changed the corresponding column in database from vachar(32) to varchar(128),

Tried to change the values in wc-attribute-functions.php, and changed 28 to 128, but that didnt help..

// Validate slug.
if ( strlen( $slug ) >= 40 ) {
    /* translators: %s: attribute slug */
    return new WP_Error( ‘invalid_product_attribute_slug_too_long’, sprintf( __( ‘Slug “%s” is too long (40 characters max). Shorten it, please.’, ‘woocommerce’ ), $slug ), array( ‘status’ => 400 ) );
….

By now i am able to input a longer Attribute slug , but still get an error when saving..

screen

This is the error i get when trying to add a term to the test attribute ( with longer name)

enter image description here

here you can see i am able to create an attribute with a slug of 38 characters, however when i look in the mysql database in the "products_term_taxonomy" table, it does not show up there,

enter image description here

After changing 32 character limit to 128 in file taxonomy.php,now i can add terms to attribute.

enter image description here

And now visible also in database,

enter image description here

0
thijs thijs 2 months 0 Answers 20 views 0

Leave an answer