Change the “Add to cart” text
Uses your own words on the add-to-cart buttons of product pages and of simple products in shop lists.
Fill in your details first. Write your text in $label on the first line of the code.
<?php
// Your text, e.g. "Buy now" or "Στο καλάθι".
$label = 'Add to basket';
add_filter( 'woocommerce_product_single_add_to_cart_text', static fn() => $label );
add_filter(
'woocommerce_product_add_to_cart_text',
static function ( $text, $product ) use ( $label ) {
// In shop lists, only buttons that add to the cart straight away.
return $product && $product->is_type( 'simple' ) && $product->is_purchasable() && $product->is_in_stock() ? $label : $text;
},
10,
2
);
In these packs
- WooCommerce essentials: The small WooCommerce changes shop owners ask for most.