function file update

This commit is contained in:
magepeopleteam 2021-02-04 07:34:54 +00:00
parent a143a4f6d5
commit 937d110d51
1 changed files with 22 additions and 19 deletions

View File

@ -2717,24 +2717,27 @@ function mep_hide_event_order_meta_in_emails( $meta ) {
} }
add_filter( 'woocommerce_order_item_get_formatted_meta_data', 'mep_hide_event_order_data_from_thankyou_and_email', 10, 1 ); add_filter( 'woocommerce_order_item_get_formatted_meta_data', 'mep_hide_event_order_data_from_thankyou_and_email', 10, 1 );
if (!function_exists('mep_hide_event_order_data_from_thankyou_and_email')) { if (!function_exists('mep_hide_event_order_data_from_thankyou_and_email')) {
function mep_hide_event_order_data_from_thankyou_and_email($formatted_meta){ function mep_hide_event_order_data_from_thankyou_and_email($formatted_meta){
$hide_location_status = mep_get_option('mep_hide_location_from_order_page', 'general_setting_sec', 'no'); $hide_location_status = mep_get_option('mep_hide_location_from_order_page', 'general_setting_sec', 'no');
$hide_date_status = mep_get_option('mep_hide_date_from_order_page', 'general_setting_sec', 'no'); $hide_date_status = mep_get_option('mep_hide_date_from_order_page', 'general_setting_sec', 'no');
$hide_location = $hide_location_status == 'yes' ? array('Location') : array(); $location_text = mep_get_option('mep_location_text', 'label_setting_sec', __('Location', 'mage-eventpress')) ? mep_get_option('mep_location_text', 'label_setting_sec', __('Location', 'mage-eventpress')) : 'Location';
$hide_date = $hide_date_status == 'yes' ? array('Date') : array(); $date_text = mep_get_option('mep_event_date_text', 'label_setting_sec', __('Date', 'mage-eventpress')) ? mep_get_option('mep_event_date_text', 'label_setting_sec', __('Date', 'mage-eventpress')) : 'Date';
$hide_location = $hide_location_status == 'yes' ? array($location_text) : array();
$hide_date = $hide_date_status == 'yes' ? array($date_text) : array();
$default = array('event_id'); $default = array('event_id');
$default = array_merge($default,$hide_date); $default = array_merge($default,$hide_date);
$hide_them = array_merge($default,$hide_location); $hide_them = array_merge($default,$hide_location);
$temp_metas = []; $temp_metas = [];
foreach($formatted_meta as $key => $meta) { foreach($formatted_meta as $key => $meta) {
if ( isset( $meta->key ) && ! in_array( $meta->key, $hide_them ) ) { if ( isset( $meta->key ) && ! in_array( $meta->key, $hide_them ) ) {
$temp_metas[ $key ] = $meta; $temp_metas[ $key ] = $meta;
} }
} }
return $temp_metas; return $temp_metas;
} }
} }