Public Ticket #3509343

botton aggiungi al carrello

Closed
Comments
53 Tickets 14
mariateresa started the conversation 3 years ago on October 27, 2023 at 4:04pm

I would like that when 

i login--> the butto is "aggiungi al carrello"

I not login in--> the button is "leggi tutto"



2,762
KingsPlugins replied 3 years ago on October 27, 2023 at 4:14pm

Hi there,

To do this, please try to add this PHP code snippet to your site:

add_filter('woocommerce_product_single_add_to_cart_text', 'b2bking_replace_add_to_cart_text');
add_filter('woocommerce_product_add_to_cart_text', 'b2bking_replace_add_to_cart_text');
function b2bking_replace_add_to_cart_text() {
    if (is_user_logged_in()){
        return '🛒  Aggiungi al carrello';
    } else {
        return 'Leggi tutto';
    }
}

A PHP snippet can be added to functions.php, or by following our guide here: https://b2bkingplugin.com/docs/how-to-add-a-snippet-php-or-js/

I am not 100% sure if this will work - it depends on your theme and site. If it does not work, I can try to find a solution - I will need a backend login to the site, or a staging site.

Kind regards,

Stefan

Sign In