custom parameter
-
Hi can any one give me full code for custom parameter such as tracking link
-
Hello @rdcc34 ,
add_filter('woom_additional_template_params', 'function_name', 10, 2);
function function_name($parameters, $order)
{
$custom_params = array(
"param1" => '',
"param2" => ''
);
if ($order !== null) {
$custom_params = array(
"param1" => 'value1',
"param2" => 'value2'
);
}
$parameters = array_merge($parameters, $custom_params);
return $parameters;
}The code mentioned above demonstrates how to provide customised parameters when selecting a template message on the WC Messaging template setting page. Once you’ve specified the parameters you require, you can select the template messages and matching parameters as needed.
For an example you can refer the blog post : https://sevengits.com/add-custom-parameters-on-wc-messaging-templates/
Thank you!
I use this code but it show error, can any one check it what is wrong
add_filter('woom_additional_template_params', 'function_name', 10, 2);
function function_name($parameters, $order)
{
$custom_params = array(
"order_total" => '',
);
if ($order !== null) {
$custom_params = array(
"order_total" => $order->get_total()
);
}
$parameters = array_merge($parameters, $custom_params);
return $parameters;
}Hello @rdcc34 ,
Previous code has some styling issues.You can go for the code give below:
add_filter('woom_additional_template_params', 'woom_add_order_total_to_params', 10, 2);
function woom_add_order_total_to_params($parameters, $order)
{
$custom_params = array(
"order_total" => '',
);
if ($order !== null) {
$custom_params = array(
"order_total" => $order->get_total()
);
}
$parameters = array_merge($parameters, $custom_params);
return $parameters;
}You can refer the blog post : https://sevengits.com/add-custom-parameters-on-wc-messaging-templates/
Thank you!
Hi can you give me a full code for purched product name and tracking link
Hello @rdcc34 ,
How your tracking link will look like? is it look like above or you have a custom tracking link?
If you can explain your use case little bit more we can add more supports in upcoming versions.
Thank you!
The topic ‘custom parameter’ is closed to new replies.