Add to Cart Text

By Keyvan Hardani

0+ active installationsVersion 2.0.0

Change the WooCommerce "Add to cart" button text per product type, category or product – separately for product pages and the shop.

Description

Add to Cart Text lets you replace the WooCommerce button texts such as “Add to cart”, “Select options” or “Read more” with your own wording – without touching templates or code.

Features

  • Per product type: simple, variable, grouped and external products (plus subscriptions and bookings when those extensions are active).
  • Two contexts: one text for the single product page, another one for the shop, category pages and product blocks.
  • Per category: set a text on a product category – it is inherited by its subcategories. The most specific category wins.
  • Per product: a “Button text” tab in the product editor overrides everything else.
  • Out of stock text: replaces “Read more” on products that are out of stock or cannot be bought.
  • Placeholders: {name} (product name) and {price} (current price), e.g. “Buy {name} for {price}”.
  • “Added to cart” message: optional own wording with {products} and {count}; the “View cart” button is kept.
  • Master switch to return to the WooCommerce defaults at any time without losing your texts.
  • Works with classic themes, block themes, the Product Button block and the Store API.
  • Compatible with High-Performance Order Storage (HPOS) and the Cart & Checkout blocks.
  • Abilities API: read-only ability add-to-cart-text/get-button-text for AI agents and automations (WordPress 7.x).
  • Unicode and emojis are supported. All input is sanitized, all output is escaped.

Priority

  1. Product (tab “Button text” in the product editor)
  2. Product category (or its parent category)
  3. Product type (WooCommerce › Settings › Products › Add to cart text)
  4. WooCommerce default

If a product cannot be bought, the out of stock text is used – or the WooCommerce default “Read more” if you left it empty.

Developers

  • adtct_button_text – filter the resolved text: ( string $text, WC_Product $product, string $context ), context is single or archive.
  • adtct_product_types – add your own product type slugs to the settings screen.
  • Ability add-to-cart-text/get-button-text – input { product_id, context }, output { text, source, source_id, … }. Requires the edit_products or manage_woocommerce capability. Example: wp_get_ability( 'add-to-cart-text/get-button-text' )->execute( array( 'product_id' => 42, 'context' => 'archive' ) ).

Documentation and support: hardani.de/add-to-cart-text

Installation

  1. Install and activate WooCommerce.
  2. Install the plugin via Plugins › Add New (search for “Add to Cart Text”) or upload the ZIP file.
  3. Activate the plugin.
  4. Go to WooCommerce › Settings › Products › Add to cart text and enter your texts.
  5. Optional: set texts on product categories (Products › Categories) or on single products (tab “Button text”).

FAQ

Which pages are affected?

“Product page” changes the button on single product pages. “Shop & archives” changes the buttons in the shop, on category and tag pages, in product blocks and wherever WooCommerce uses the loop button text.

My text does not show up.

Check the priority list above: a text on the product or its category wins over the product type. If the product is out of stock, the out of stock text is used. Also clear your page cache after changing texts.

Can I use HTML in the button text?

No. Button texts are plain text for security reasons. Emojis and all Unicode characters work.

Does it work with variable products?

Yes. Variable products have their own row (“Select options” in the shop, “Add to cart” on the product page).

Which PHP and WordPress versions are required?

PHP 8.3 or newer (tested with PHP 8.3, 8.4 and 8.5) and WordPress 7.0 or newer. On older PHP versions WordPress will not activate the plugin.

What happens to my settings from version 1.0?

They are moved to the new settings automatically on the first page load after the update.

Does the plugin store personal data?

No. It only stores your button texts.

Screenshots

Changelog

2.0.0

  • Rebuilt from scratch for WordPress 7.1, WooCommerce 11 and modern PHP (8.3 – 8.5): strict types, enums, readonly classes.
  • New requirements: PHP 8.3+ and WordPress 7.0+.
  • New: separate texts for product pages and shop/archives.
  • New: variable, external, subscription and booking products.
  • New: texts per product category (inherited by subcategories) and per product.
  • New: out of stock text, placeholders {name} and {price}, custom “added to cart” message.
  • New: modern settings screen and master switch.
  • New: read-only ability add-to-cart-text/get-button-text (Abilities API).
  • New: HPOS and Cart & Checkout blocks compatibility, “Requires Plugins: woocommerce”.
  • Security: all input sanitized, all output escaped, nonces and capability checks everywhere.
  • Settings of version 1.0 are migrated automatically; all data is removed when the plugin is deleted.

1.0

  • First release.