Jump to content

Hook to display cancellation reason in client area


Recommended Posts

Following hook should do the trick:

<?php

add_hook('ClientAreaProductDetailsOutput', 1, function($service) {
    if (!empty($service['service']->cancellationRequests['0']['reason'])) {
        $cancellationReason = htmlspecialchars ($service['service']->cancellationRequests['0']['reason'], ENT_QUOTES);
        
        return "
            <script>
                var cancellationReason = new DOMParser().parseFromString('{$cancellationReason}', 'text/html');
                jQuery('#alertPendingCancellation').append(`<br />Reason: \${cancellationReason.documentElement.textContent}`);
            </script>
        ";
    }
});

Save that under "/includes/hooks/<a_filename>.php" to activate.

screenshot-06-08-2021-21-47-39.thumb.png.b273ecb3f2c495438ce9c88f081ebddd.png 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated