0

how to change the “return to shop” button text?

i can not find way to change it on woocommerce.

Thanks

closed as off-topic by Michael, fuxia Jan 3 '18 at 21:51

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

1

If you browse the source code of the plugin, you'll see "return to shop" is used three times in:

includes/class-we-checkout.php:956
includes/class-wc-ajax.php:257
templates/car/cart-empty.php:33

for the first two, the classes - there's no hooks or filters to change that text. There's no function that conjurors that text either. It is, as it is. However, you can do a work-around and change it with jQuery on your site. In your theme, or a custom plugin, you can add:

add_action( 'wp_footer', function(){
    ?>
    <script>
    jQuery(window).load(function() {
        if (jQuery('a.button.wc-backward'))
            jQuery('a.button.wc-backward').text("My Custom Text");
    });
    </script>
    <?php
});

As for the third instance, the template - it too will work with the above, but you can hard code this one if you want. In the file itself, it says:

This template can be overridden by copying it to yourtheme/woocommerce/cart/cart-empty.php

So you can do that, and hard code the text as desired.

Not the answer you're looking for? Browse other questions tagged or ask your own question.