'Change Add to cart button text for specific products in Woocommerce

In woocommerce I have been able to change all the "Add to cart" buttons text to "+", using the code below:

add_filter('woocommerce_product_add_to_cart_text', 
'wh_archive_custom_cart_button_text');   // 2.1 +

function wh_archive_custom_cart_button_text()
{
    return __('+', 'woocommerce');
}

But now I would like to change the button text for specific products to (lowercase) "add to cart".

Some help is appreciated.



Solution 1:[1]

If you want to change add to cart button text of a specific product without coding, here is the solution.

  1. .postid-1324 => Product id
  2. .single_add_to_cart_button => add to cart button class

.postid-1324 .single_add_to_cart_button:after {
    content: '';
    background: rgb(106,191,119);
    width: 110px;
    height: 45px;
    position: absolute;
    left: 0;
    right: 0;
    text-align: center;
    margin: 0 auto;
}

.postid-1324 .single_add_to_cart_button:before {
    content: 'add money to wallet';
    position: absolute;
    z-index: 9999998;
    left: 0;
    right: 0;
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pradeep