Hi Minesh
Now you should be able to log in.
There is no problem URL because I did not come so far.
The problem was that when I pasted the code above into the function.php file the whole site got into critical error mode. When I removed the code from the function.php file the site was up and running again.
My guess is that it’s something wrong with code.
BR
Tobias
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
I've added the code I shared to "Custom Code" section offered by Toolset:
=> hidden link
function func_add_custom_email_placeholders( $string, $email ) {
// Get WC_Order object from email
$order = $email->object;
/// Get and Loop Over Order Items
foreach ( $order->get_items() as $item_id => $item ) {
$product_id = $item->get_product_id();
$for_och_efternamn_name = get_post_meta($product_id, 'wpcf-for-och-efternamn', true);
$e_post_uppdragsgivare_name = get_post_meta($product_id, 'wpcf-e-post-uppdragsgivare', true);
$telefonnummer_uppdragsgivare_name = get_post_meta($product_id, 'wpcf-telefonnummer-uppdragsgivare', true);
}
// Add new placeholders
$new_placeholders = array(
'{_for_och_efternamn_name}' => $for_och_efternamn_name,
'{_e_post_uppdragsgivare_name}' => $e_post_uppdragsgivare_name,
'{_telefonnummer_uppdragsgivare_name}' => $telefonnummer_uppdragsgivare_name,
);
// return the string with new placeholder replacements
return str_replace( array_keys( $new_placeholders ), array_values( $new_placeholders ), $string );
}
add_filter( 'woocommerce_email_format_string' , 'func_add_custom_email_placeholders', 20, 2 );
More info:
- https://toolset.com/documentation/programmer-reference/adding-custom-code/using-toolset-to-add-custom-code/#benefits-of-adding-custom-code-using-toolset
Hi Minesh
Thank you very much!
It works when I use the Woocommerce default customizer. When I try to add the placeholders in a template from a “email customizer plugin” it doesn’t work. Is this something you can help with or should I contact the plugin support?
BR
Tobias