• I’m trying to make a woocommerce site for the first time.

    The problem I am running into is that I want the user to be able to enter some unique text for the front of a T shirt. So they would need to write something like “Cats & Dogs” but in the cart and throughout the checkout process this would turn into “cats-dogs”.

    As you can see, this is a major problem because, as the seller, I have the wrong information. How can I fix this please?

    Thank you.

    P.S. I edited variable.php to “hack” in the text field where the user can type with this code:

    <input type="text" id="<?php echo esc_attr( sanitize_title($name) ); ?>" value="Enter text here" maxlength="35" size="38" onkeyup="caps(this)"
    name="attribute_<?php echo sanitize_title($name); ?>"/>

    And then in the product I just type a specific phrase for the attribute and this box becomes enabled.

    https://www.ads-software.com/extend/plugins/woocommerce/

Viewing 8 replies - 1 through 8 (of 8 total)
  • It’s “sanitize_title( $name )” doing this. You’re using a WP function only meant to sanitize post/page titles for making post/page slugs.

    Thread Starter kittensforgood

    (@kittensforgood)

    I tried taking out the sanitize_title and just the sanitize but this did not work. Quite frankly, I know nothing about wordpress coding… but I tried a variety of things.

    How would I go about making the change I want (making the cart and checkout process use the user-entered text “as-is”?

    Thank you for the quick reply too.

    Dunno off-hand, I’d have to read through the code to find out. Your best bet is to hire someone that knows what they’re doing.

    Thread Starter kittensforgood

    (@kittensforgood)

    hmm, well that stinks, I was thinking this wasn’t too complex. hence, trying to do it myself. I’m pretty decent with html and web stuff in general… but all these other weird tongues have taken me for a loop. woocommerce’s site has pretty dismal support/tutorials it seems too.

    WooThemes and WooCommmerce developers are not in a position to teach anyone how to read and write PHP ?? That burden is upon you. Or, as I suggested, just give a competent dev some bux to do it for you and be done with it. When they get done, read their code to see how they did it. No higher education is free! Besides you’re opening a store – to make money – spend a little if required and write it off as a business expense ??

    Thread Starter kittensforgood

    (@kittensforgood)

    Oh I couldn’t agree more! I am not looking to learn an entire language! ??

    Thread Starter kittensforgood

    (@kittensforgood)

    anyone else?

    Thread Starter kittensforgood

    (@kittensforgood)

    I would really like if anyone can tell me where I can learn to swap out the slugs in the cart for the actual user-submitted text. Thank you.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘cart shows slug instead of useful text’ is closed to new replies.