Automattic\WooCommerce\Internal\Admin\EmailPreview
EmailPreview::set_up_filters
Set up filters for email preview.
Метод класса: EmailPreview{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$EmailPreview = new EmailPreview(); $EmailPreview->set_up_filters();
Код EmailPreview::set_up_filters() EmailPreview::set up filters WC 10.3.5
public function set_up_filters() {
$this->switch_to_site_locale();
// Always show shipping address in the preview email.
add_filter( 'woocommerce_order_needs_shipping_address', array( $this, 'enable_shipping_address' ) );
// Email templates fetch product from the database to show additional information, which are not
// saved in WC_Order_Item_Product. This filter enables fetching that data also in email preview.
add_filter( 'woocommerce_order_item_product', array( $this, 'get_dummy_product_when_not_set' ), 10, 1 );
// Enable email preview mode - this way transient values are fetched for live preview.
add_filter( 'woocommerce_is_email_preview', array( $this, 'enable_preview_mode' ) );
// Use placeholder image included in WooCommerce files.
add_filter( 'woocommerce_order_item_thumbnail', array( $this, 'get_placeholder_image' ) );
// Make products in preview considered downloadable and provide dummy file so WC core shows downloads.
add_filter( 'woocommerce_is_downloadable', array( $this, 'force_product_downloadable' ), 10, 1 );
add_filter( 'woocommerce_product_file', array( $this, 'provide_dummy_product_file' ), 10, 1 );
// Provide dummy downloadable items for email preview.
add_filter( 'woocommerce_order_get_downloadable_items', array( $this, 'get_dummy_downloadable_items' ), 10, 1 );
}