WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
change button text - select option (29 posts)

  1. Adrian@Marcue
    Member
    Posted 1 year ago #

    I want to change the button text from "select options" to something else, like "purchase" or "choose size" - see link below for an example
    http://marcue.com.au/womens-handmade-leather-shoes-light-blue-double-brogue/

    Under Woo Commerce Docs there is an article which describes changing the add to cart button text as follows:
    <?php

    add_filter('single_add_to_cart_text', 'woo_custom_cart_button_text');

    function woo_custom_cart_button_text() {

    return __('My Button Text', 'woocommerce');

    }

    Problem is where do I put it? And, is this the solution Im looking for?

    http://wordpress.org/extend/plugins/woocommerce/

  2. saadat68
    Member
    Posted 1 year ago #

    Hi
    you must paste this code in functions.php in your theme files

  3. FishFush
    Member
    Posted 1 year ago #

    Will this method work for changing the words:
    - "Category: Example" on product pages?

    And also things like:
    - "All Products" on the homepage?

    Thanks!

  4. Adrian@Marcue
    Member
    Posted 1 year ago #

    Just a heads up, there is a plugin for Woocommerce called WooCommerce Customizer.

    Perfect for PHP noobs like me.

    It worked for me

  5. FishFush
    Member
    Posted 1 year ago #

    Thanks Adrian!

    Is that working without any bugs/problems? :)

  6. FishFush
    Member
    Posted 1 year ago #

    Ah, it doesn't seem to be able to change any of this stuff (but thanks!)

  7. helgatheviking
    Member
    Posted 1 year ago #

    Really neat shoes!

    But yes, that code goes in your theme's functions.php file.

    @FishFush - it is a similar procedure (using filters) but code Adrian provided is for something specific.

  8. Adrian@Marcue
    Member
    Posted 1 year ago #

    Thank you!
    Any pointers for removing the grey border? Or resizing it?
    Im pulling my hair out, firebug only gets me so far.......grrrr

  9. FishFush
    Member
    Posted 1 year ago #

    Border seems to be simple CSS

  10. Adrian@Marcue
    Member
    Posted 1 year ago #

    Thats what I thought - I must be overlooking something

  11. FishFush
    Member
    Posted 1 year ago #

    <p class="product" style="border:4px solid #ccc; padding: 12px;">

  12. royho
    Member
    Posted 1 year ago #

    Try to remove the inline CSS and put that in it's own CSS file or along with your theme CSS file.

  13. Adrian@Marcue
    Member
    Posted 1 year ago #

    I have encountered that code before, but where do I put it?
    Woocommerces CSS or my theme its Style CSS?
    Its seems so frustratingly simple

  14. royho
    Member
    Posted 1 year ago #

    It really doesn't matter where you put it. As long as it gets loaded and has the correct specificity. But try to put it somewhere where it will not be overridden when you do updates.

  15. Adrian@Marcue
    Member
    Posted 1 year ago #

    Ok, my theme has provision under its options to dump CSS code in for quickly modifying its appearance. Pasted below is an example of what I have done:

    #singlular-sidebar {
    display: none;
    float: left;
    margin-bottom: 0;
    margin-top: 0;
    padding-bottom: 22px;
    }

    The code suggested by FishFush gets dropped, what are those <p ...p> tags. Showing my igorance here ..........

  16. royho
    Member
    Posted 1 year ago #

    Just add

    .product {border:none;}
    exactly as you see here.

  17. Adrian@Marcue
    Member
    Posted 1 year ago #

    No joy :-(
    Going to have to dig deeper but thanks for your help

  18. royho
    Member
    Posted 1 year ago #

    No joy because you didn't remover the inline CSS? To test if this is the case you can try to override it by using !important.

    So try

    .product {border:none !important;}
  19. Adrian@Marcue
    Member
    Posted 1 year ago #

    That worked! Thank you very much!
    Again, showing my ignorance, Im going to need to find out what inline CSS means.

    Cheers

  20. golfclubadvisor
    Member
    Posted 1 year ago #

    I have encountered the same issue, however I used the code above to 'hide' the border. I really need to reduce the border or remove it all together so as not to leave a gap between the text and the add to cart button. Any ideas?

    I have checked the woo commerece css file and cannot see reference to it in there but can find the code

    "<p class="product" style="border:4px solid #ccc; padding: 12px;">"

    when inspecting the element in google chrome. Its driving me insane as It is easily fixed I imagine!

  21. VIVA Design
    Member
    Posted 1 year ago #

    Hi Adrian

    I am having the same problem, I'm using the woocommerce plugin - how do I change the text of 'Select Options' to Buy or Add to cart

  22. VIVA Design
    Member
    Posted 1 year ago #

    Sorry I have fixed it with WooCommerce Customizer - thanks for the post!

  23. jameskoster
    Member
    Plugin Author

    Posted 1 year ago #

    Hi there,

    For other users, you can change the add-to-cart button text with the following snippet;

    For the single product page;

    add_filter('single_add_to_cart_text', 'woo_custom_cart_button_text_single');
    
    function woo_custom_cart_button_text_single() {
    
                        return __('My Button Text', 'woocommerce');
    
                }

    For the others;

    add_filter('add_to_cart_text', 'woo_custom_cart_button_text');
    
    function woo_custom_cart_button_text() {
    
                        return __('My Button Text', 'woocommerce');
    
                }

    Thanks, Jay

  24. newsgrip
    Member
    Posted 1 year ago #

    I have been trying to remove the border around the cart button this is the link for my website. http://www.kathachitra.com/blog/bajanaama/ when I see it through firebug I find there are multiple classes defined
    <p class="product woocommerce" I am not able to understand how to remove this in y style.css file.

  25. vikkiranag
    Member
    Posted 1 year ago #

    Dear james
    what if we need to change the text of update cart as well as your cart is empty etc hence i needed to change the cart text everywhere on the site with BASKET WHAT I NEEDED TO DO TO DO SO.. KINDLY REPLY

  26. KayBeSee
    Member
    Posted 1 year ago #

    I am having the same issue with the inline CSS. I have been searching almost every file contained in WooCommerce to find where it's pulling this inline code from and cannot figure it out.

    I guess, in theory, you could use an external CSS file and use !important but I'd prefer to get rid of the inline CSS (or modify it actually, since it's only for a specific instance when I'm using the Add to Cart hook).

    Has anyone had any luck finding where they embed this code? I've seen in other themes where they put it in a .js file, but like I said, I've had no luck.

  27. Moses001
    Member
    Posted 1 year ago #

    How do I remove or change the wording for the add_to_cart_text that displays in the Compare Products (Product Comparison Table)?

    I tried using the code <?php

    add_filter('single_add_to_cart_text', 'woo_custom_cart_button_text');

    function woo_custom_cart_button_text() {

    return __('My Button Text', 'woocommerce');

    } in the class-wc-compare-functions.php of Woocommerce Compare Products Plugin and replace wording My button text with learn more. It didn't work.

    Where would I put the code for the 'add-to-cart' that displays when I view the results of clicking to compare products.

    You thoughts would be helpful. I have exhausted options to try.

    Thank you.

  28. CapitalH
    Member
    Posted 1 year ago #

    Thanks for the tips,

    One more thing to add. To change the variable products button text you can use this:

    add_filter('variable_add_to_cart_text', 'woo_custom_cart_button_text');

    function woo_custom_cart_button_text() {

    return __('My Button Text', 'woocommerce');

    }

  29. elsonce
    Member
    Posted 11 months ago #

    hi i want to change the ''from'' price text... and put sth like tax inclusiv... is there any way to do it?? thank you

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.