Is there a way to change a view product button to an add to quote button?

Viewed 85

I've added the ELEX Woocommerce add to quote plugin, and its working fine, except the theme we are using (goodlayers infinite), doesn't have the add to quote button show up in the shop page.

I'm thinking the easiest way to change this is change the "view details" button to the add to quote button.

This is the code for the view products button, though I can't actually find it anywhere in the theme editor.

<a href="url" class="gdlr-core-product-view-detail"><i class="fa fa-eye"></i><span>View Details</span></a>

I have tried the following, but to no success

add_filter( 'gldr-core-product-view-detail', 'replace_default_button' );
function replace_default_button(){
    return '<button>Add to Quote</button>';
}
1 Answers

An easy way to do it would be to translate the text as follows:

function change_string($translated_text, $text, $domain) {
    $translated_text = str_replace('View Details', 'Add a Quote', $translated_text);
    return $translated_text;
    }
add_filter('gettext', 'change_string', 100, 3);

You might find this answer helpful also if you need another approach.

Related