Waqas Saeed Posted November 13, 2020 Share Posted November 13, 2020 <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); function facebookPixelCheckOut() { $pixelID1 = "843460539109207"; $codepixel = "<script> !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod? n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n; n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0; t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window, document,'script','//connect.facebook.net/en_US/fbevents.js'); fbq('init', '".$pixelID1."'); fbq('track', \"InitiateCheckout\"); </script> <noscript> <img height=\"1\" width=\"1\" style=\"display:none\" src=\"https://www.facebook.com/tr?id=".$pixelID1."&ev=InitiateCheckout&noscript=1\" />"; echo $codepixel; } //add_hook("ClientAreaPageViewInvoice",1,"facebookPixelCheckOut"); add_hook("AfterShoppingCartCheckout",0,"facebookPixelCheckOut"); ?> Hello. This conversion works but if user click on the button Check Out, it shows blank page to user, and after user refresh the page it shows the page. What is causing due to hook that it is bringing up the blank page. but no error. 0 Quote Link to comment Share on other sites More sharing options...
0 Kian Posted November 13, 2020 Share Posted November 13, 2020 AfterShoppingCartCheckout does not support response. You can't echo/return anything. Your echo is breaking the redirect. 0 Quote Link to comment Share on other sites More sharing options...
0 Waqas Saeed Posted November 14, 2020 Author Share Posted November 14, 2020 @Kian thanks buddy, oh! I didn't got the goodie bag . 😞 Anyways, I'm new to WHMCS code, framwork What to do here if I want this script to run. Could you help me using my code to run at the point where it can return/echo without interrupting the redirect. the point the customer completes the checkout and receives the unpaid invoice. 0 Quote Link to comment Share on other sites More sharing options...
Question
Waqas Saeed
Hello.
This conversion works but if user click on the button Check Out, it shows blank page to user, and after user refresh the page it shows the page. What is causing due to hook that it is bringing up the blank page. but no error.
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.