Skip to content
Docs
Get RestroPress

Filter

rp_add_to_cart

Updated
On this page

Filters the Add To Cart button text used by the frontend script.

Runs in RP_Frontend_Scripts::load_scripts() and the result is localised as the add_to_cart string of the rp_scripts JavaScript object, which the product modal script writes into the submit button.

Parameters#

ParameterTypeDescription
$textstringButton text, Add To Cart by default.

Return value#

string. The button text.

Example#

function my_add_to_cart_text( $text ) {
	return __( 'Add to order', 'my-textdomain' );
}
add_filter( 'rp_add_to_cart', 'my_add_to_cart_text' );

Source#

Applied in:

  • includes/class-rpress-frontend-scripts.php (line 320), in RP_Frontend_Scripts::load_scripts()

See also#

Was this page helpful?