Automattic\WooCommerce\Internal\Admin\EmailPreview

EmailPreview::force_product_downloadablepublicWC 1.0

Force products in preview to be considered downloadable so core renders downloads section.

Method of the class: EmailPreview{}

Hooks from the method

Returns

true|false.

Usage

$EmailPreview = new EmailPreview();
$EmailPreview->force_product_downloadable( $is_downloadable );
$is_downloadable(true|false) (required)
Current value.

EmailPreview::force_product_downloadable() code WC 10.4.3

public function force_product_downloadable( $is_downloadable ) {
	/**
	 * Filters whether the current request is an email preview.
	 *
	 * When true, products should be considered downloadable so the downloads
	 * section renders in applicable emails during preview.
	 *
	 * @since 9.6.0
	 *
	 * @param bool $is_email_preview Whether preview mode is active.
	 */
	if ( apply_filters( 'woocommerce_is_email_preview', false ) ) {
		return true;
	}
	return $is_downloadable;
}