ulc_wc_email_include_codes_table
Filters whether to include the codes table in WooCommerce emails.
add_filter( 'ulc_wc_email_include_codes_table', $callback, 10, 1 );
Description
This filter allows developers to control whether the order codes table is included in WooCommerce emails. By returning `false`, you can prevent the table from being displayed. This is useful for customizing email content or when the table is not relevant to specific orders or customers.
Usage
add_filter( 'ulc_wc_email_include_codes_table', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
<?php
/**
* Example of how to use the 'ulc_wc_email_include_codes_table' filter.
* This example disables the inclusion of the codes table in WooCommerce emails.
*
* @param bool $include_codes_table Whether to include the codes table.
* @return bool False to disable, true to enable.
*/
add_filter(
'ulc_wc_email_include_codes_table',
function ( $include_codes_table ) {
// In this specific scenario, we want to prevent the codes table from
// being added to WooCommerce emails. This could be useful if you have
// a custom solution for displaying codes or if you don't want them shown.
return false;
},
10, // Priority. Default is 10.
1 // Accepted arguments. This filter only receives one argument.
);
?>
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/classes/integrations/woocommerce/class-woo-automator-codes.php:82
),
1
);
add_action(
'init',
function () {
if ( apply_filters( 'ulc_wc_email_include_codes_table', true ) ) {
// Check whether we have to add the codes table before or after the order table
$position = apply_filters( 'ulc_wc_email_codes_table_position_order_table', 'after' );
$email_codes_table_hook = 'woocommerce_email_after_order_table';
if ( $position === 'before' ) {
$email_codes_table_hook = 'woocommerce_email_before_order_table';
}