Advertisement
khalequzzaman17

Display Cancellation Reason

Oct 8th, 2022 (edited)
845
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.60 KB | None | 0 0
  1. <?php
  2.  
  3. add_hook('ClientAreaProductDetailsOutput', 1, function($service) {
  4.     if (!empty($service['service']->cancellationRequests['0']['reason'])) {
  5.         $cancellationReason = htmlspecialchars ($service['service']->cancellationRequests['0']['reason'], ENT_QUOTES);
  6.        
  7.         return "
  8.            <script>
  9.                var cancellationReason = new DOMParser().parseFromString('{$cancellationReason}', 'text/html');
  10.                jQuery('#alertPendingCancellation').append(`<br />Reason: \${cancellationReason.documentElement.textContent}`);
  11.            </script>
  12.        ";
  13.     }
  14. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement