Skip to content

Early-bird lifetime licence: $199 once, for the first 200 buyers only. See the offer

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.

  • Type PHP
  • Runs Everywhere (runs as WordPress loads)
  • Needs WooCommerce
  • Tested with WordPress 7.1, WooCommerce 11.1

Fill in your details first. Write your text in $label on the first line of the code.

PHP
<?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

Move your snippets over this afternoon.

Importing changes nothing until you switch over, and your old shortcodes keep working.