• Resolved rdcc34

    (@rdcc34)


    Hi can any one give me full code for custom parameter such as tracking link

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support ashlyjohny

    (@ashlyjohny)

    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!

    Thread Starter rdcc34

    (@rdcc34)

    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;

    }
    Plugin Support ashlyjohny

    (@ashlyjohny)

    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!

    Thread Starter rdcc34

    (@rdcc34)

    Hi can you give me a full code for purched product name and tracking link

    Plugin Support ashlyjohny

    (@ashlyjohny)

    Hello @rdcc34 ,

    https://customdomain.com/product?utm_source=campaign_source&utm_medium=medium&utm_campaign=name&utm_id=campaignID

    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!

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.