WC_Emails::replace_placeholderspublicWC 3.7.0

Replace placeholder text in strings.

Method of the class: WC_Emails{}

No Hooks.

Returns

String. Email footer text with any replacements done.

Usage

$WC_Emails = new WC_Emails();
$WC_Emails->replace_placeholders( $text );
$text(string) (required)
Email footer text.

Changelog

Since 3.7.0 Introduced.

WC_Emails::replace_placeholders() code WC 10.5.0

public function replace_placeholders( $text ) {
	$domain = wp_parse_url( home_url(), PHP_URL_HOST );

	return str_replace(
		array(
			'{site_title}',
			'{site_address}',
			'{site_url}',
			'{woocommerce}',
			'{WooCommerce}',
			'{store_address}',
			'{store_email}',
		),
		array(
			$this->get_blogname(),
			$domain,
			$domain,
			'<a href="https://woocommerce.com">WooCommerce</a>',
			'<a href="https://woocommerce.com">WooCommerce</a>',
			$this->get_store_address(),
			$this->get_from_address(),
		),
		$text
	);
}