Okay
  Public Ticket #3509343
botton aggiungi al carrello
Closed

Comments

  •  14
    mariateresa started the conversation

    I would like that when 

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

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



  •  2,218
    WebWizards replied

    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://woocommerce-b2b-plugin.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