• Resolved crawp09

    (@crawp09)


    Hi. I have a Woocommerce shop where i want to change the text on the button “place order” with this code snippet:

    add_filter(‘woocommerce_order_button_text’, ‘change_order_button_text_to_custom’);

    function change_order_button_text_to_custom($button_text) {
    return ‘Afgiv bestilling’;
    }

    But the change does not have any effect on the front end. The button is translated by the system (running Danish language) from “Place Order” to “Godkend og betal”.

    My code snippet does not have any effect dispite the code snippet seems to be loaded on the page. Can anyone help?

    I prefer to do this by the code snippet instead of using fx loca (translation plugin)

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support omarfpg a11n

    (@omarfpg)

    Hi @crawp09,

    Can you tell us if you’re using the default checkout (using the shortcodes) or if you’re using the blocks checkout?

    The easiest way to translate any string in WooCommerce is through the Say What? plugin, though.

    Using the Say What? plugin can assist if you only wish to translate or change a few words without editing a WordPress theme’s .PO file. Requires no custom code.

    When activated, it asks for:

    1. Original string – text you are translating. View the plugin source code to see the exact string.
    2. Text domain – woocommerce
    3. Text you want to display

    Additionally, if you think the current translation isn’t accurate in your language, you can contribute to the translation for it by following this guide! https://woocommerce.com/document/woocommerce-localization/#translating-woocommerce-into-your-language.

    I hope this helps so far!

    Cheers!
    -OP

    • This reply was modified 2 years, 1 month ago by omarfpg a11n.
    Thread Starter crawp09

    (@crawp09)

    Hi omarfpg (woo-hc).

    I’m using shortcode woocommerce_checkout. See https://julegaver.vicom.dk/checkout/

    I have activated Loco Translate to change the button text as I found it too difficult to get the code snippet to work.

    I’m just wondering what happens with the translation whenever there will be updates of theme and plugin (woocommerce). Will my translation be over ruled by the update.

    I still do prefer to use the code snippet to do the change of text for me….

    Thread Starter crawp09

    (@crawp09)

    Hi again.

    I just created a test page with the check out created in blocks – see https://julegaver.vicom.dk/test-side-cra/ – and the Place order button is still getting the text change from Loco. And not my text from the code snippet!

    • This reply was modified 2 years, 1 month ago by crawp09.

    Hey, @crawp09!

    Will my translation be over ruled by the update.

    You can check how to prevent this from happening here.

    I still do prefer to use the code snippet to do the change of text for me….

    While we can’t provide support for code customization as per our support policy, we do our best to offer advice and direct you to appropriate resources.

    You can visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there too.

    Please let us know if there’s anything else we can do to help or if you have any questions.

    Have a wonderful day!

    Plugin Support omarfpg a11n

    (@omarfpg)

    Hi there 👋 ,

    We haven’t heard from you in a while, so I’m going to mark this as resolved. Feel free to start a new thread if you have any more questions.

    All the best,
    Omar

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Change button text Place Order code snippet’ is closed to new replies.