How to change the text of adding to the basket on the basket page?

I’m trying to change the text of the “add to cart” button to “Full sale” when on the shopping cart page “sign up now” on product ID 4968 and be a “Book” everywhere.

Here is my code in the functions.php file:

function woo_custom_cart_button_text() {


    if (is_single('Product1')) {

        return __( 'Subscribe Now', 'woocommerce' );

    } else {

        return __( 'Book', 'woocommerce' );

    }
}


add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text' );
+4
source share
1 answer

Try changing is_single to is_page (). And enter the slug or id of the page inside is_page ().

0
source

Source: https://habr.com/ru/post/1628261/


All Articles