• Resolved shaytorn

    (@shaytorn)


    Hi there Pinal,

    First off, thank you very much for such an awesome easy to use plugin. If I can solve the below issue I will be sure to continue using the plugin and give you a 5 star rating.

    I need to change the button text from “Request Quote” to “Add to quote” to eliminate confusion with customers as the store usually quotes on multiple items not just single item quotes. Can you advise changes I can make to functions.php or where and how I can make the change to the button text.

    Thank you!

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author pinal.shah

    (@pinalshah)

    Hi @shaytorn,

    I’m glad to know you find the plugin easy to use. You can use the below filter to change the button text.

    woocommerce_product_single_add_to_cart_text

    Please attach a function with a priority of more than 99 to ensure the changes are effective.

    Adding code similar to the one shown below in the functions.php file will help achieve the desired results.


    add_filter( 'woocommerce_product_single_add_to_cart_text', 'custom_name_change', 100 );

    function custom_name_change() {

    global $post;
    $post_id = $post->ID;
    // check if setting is enabled
    $enable_quote = product_quote_enabled( $post_id );

    if ( $enable_quote ) {
    $cart_text = __( 'Add to Quote', 'quote-wc' );
    } else {
    $cart_text = __( 'Add to Cart', 'quote-wc' );
    }

    return $cart_text;
    }

    The conditions in the function check whether the product allows for quotes or no. If yes, then the text is modified else we return the standard ‘Add to Cart’ text for the button.

    I hope this helps.

    Thanks,
    Pinal

    Thread Starter shaytorn

    (@shaytorn)

    Hi Pinal

    I attempted to add this code to the functions.php file but it did not make any change to the site. I am not a professional so maybe I am doing something wrong. How do i attach a function with a priority of 99?

    Thanks,
    Shea.

    Plugin Author pinal.shah

    (@pinalshah)

    Hi Shea,

    The parameter after the function name is the priority. So in the code above 100 is the priority.

    Did the example I sent above not work? It’s untested but it should’ve worked.

    Are any errors being logged?

    Pinal

    The code worked for me, thank you!

    Thread Starter shaytorn

    (@shaytorn)

    Hi Pinal,

    Please see this image of the code added to my functions.php file. Did I make any mistakes?

    functions.php

    Thank you, I appreciate the help

    • This reply was modified 5 years, 7 months ago by shaytorn.
    Thread Starter shaytorn

    (@shaytorn)

    @svsanchez please also comment if you can help. Thanks in advance.

    • This reply was modified 5 years, 7 months ago by shaytorn.
    Plugin Author pinal.shah

    (@pinalshah)

    Hi Shea,

    I apologize for the delay in response. The code seems fine.

    A few things that you could try is:
    1. Modify the priority to 999 instead of 100 and see if it helps.
    2. Alternately, you could add an echo statement right before the return and see the value being returned.

    That will give you a better idea of where is the code going wrong and help you achieve the desired results.

    Pinal

    Plugin Author pinal.shah

    (@pinalshah)

    Hi Shea,

    I’ve added a new setting in the plugin which allows the ability to modify the Add to Cart button text from ‘Request Quote’ to the admin’s choice for products that have quotes enabled.

    The code is currently present in a branch on Github.

    https://github.com/pinalj/quotes-for-woocommerce/tree/settings-changes

    Please download the plugin copy from the branch above and replace the existing plugin copy with the downloaded copy via FTP. The setting is present in Quotes->Settings. It should allow you to change the button text as desired.

    I hope this helps. The feature will be released in the next update.

    Thanks,
    Pinal

    Pinal, I want to make sure product images appear in the new quote order when customer orders it. How can we get this into the woocommerce new order email next to each item Product Name in same format with just 100pxx100px size product photo. ?

    Paul-
    USA, Arizona

    Also this is the code for the Ancor ADD TO QUOTE button, but i want this to appear also in the product detail page. But to do this i want the dynamic php snippit code to enter for the a href=”” . Because right now from web developer tools in browser it just shows:

    /shop?add-to-cart=125 <— i want to make this part to be the shortcode or php to be dynamic based on whatever Product Item it actually it is on for the product detail page or sku.

    The original copied and pasted code here:
    Get A Quote

    Plugin Author pinal.shah

    (@pinalshah)

    Hi @abcwebtech,

    Sorry, it seems I missed your query.

    Do you mean to say that the ‘Add to Quote’ button on the Shop page contains the link ‘/shop?add-to-cart=125’ where 125 is the product ID for each of the products?

    And you want a PHP snippet to retrieve the URL which you can use to add a particular product to the cart from a custom ‘Add to Quote’ button that you are creating?

    Please note that the plugin does NOT create an ‘Add to Quote’ button on any of the front end pages. It simply renames the ‘Add to Cart’ button as ‘Add to Quote’ for any product that requires a quote.

    WooCommerce uses the args ‘add-to-cart=<product_id>’ for all such buttons. For a custom button that you wish to create the same can help you add it to the cart.

    I hope this helps.

    Pinal

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Change Button text to “Add To Quote”’ is closed to new replies.