[Skip to main content](#vessel-content)

#   How to check completed payments with facebook pixel?

##

- **[oloccina](/forum/user/23273-oloccina "View oloccina's Profile")**
- [![oloccina's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar23273.jpg)](/forum/user/23273-oloccina "View oloccina's Profile") Topic Author
- [ Offline](/forum/user/23273-oloccina)

Less More

- Posts: 224
- Thank you received: 8
-
-

7 years 7 months ago -  7 years 7 months ago [\#304595](#304595) by [oloccina](/forum/user/23273-oloccina "View oloccina's Profile")  *[How to check completed payments with facebook pixel?](/forum/26-product-category-display/897076-how-to-check-completed-payments-with-facebook-pixel#304595 "Hello, is there a way to check completed payments with facebook pixel?  And if yes, in which file exactly should I paste the pixel code among the view files? maybe checkout &gt; end or checkout &gt; after&#95;end  ?  Thank you")* was created by *[oloccina](/forum/user/23273-oloccina "View oloccina's Profile")*

Hello,
is there a way to check completed payments with facebook pixel?

And if yes, in which file exactly should I paste the pixel code among the view files?
maybe
checkout &gt; end
or
checkout &gt; after_end

?

Thank you

Last edit: 7 years 7 months ago by [oloccina](/forum/user/23273-oloccina "View oloccina's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL3Byb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTcwNzYtaG93LXRvLWNoZWNrLWNvbXBsZXRlZC1wYXltZW50cy13aXRoLWZhY2Vib29rLXBpeGVsP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86358
- Thank you received: 14293
-
-

7 years 7 months ago [\#304600](#304600) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to check completed payments with facebook pixel?](/forum/26-product-category-display/897076-how-to-check-completed-payments-with-facebook-pixel#304600 "Hello, is there a way to check completed payments with facebook pixel?  And if yes, in which file exactly should I paste the pixel code among the view files? maybe checkout &gt; end or checkout &gt; after&#95;end  ?  Thank you")*

Hi,

PolishedGeek had developed a facebook pixel plugin for HikaShop :
[ www.hikashop.com/forum/integrations/8927...ct-pages.html#282510](https://www.hikashop.com/forum/integrations/892740-how-to-add-facebook-pixel-to-product-pages.html#282510)
I'm not sure where they are with it, but it might be worth contacting them about it.

Otherwise, this thread contains already a lot of helpful information about adding a facebook pixel to HikaShop:
[ www.hikashop.com/forum/reports-statistic...d-other-scripts.html](https://www.hikashop.com/forum/reports-statistics/882935-integration-of-facebook-pixel-and-other-scripts.html)
As stated there, it's probably the file "after_end" where you want to add your code provided that your payment method directs to the payment gateway for the payment after the checkout and then comes back to your website and that you didn't set a return URL for the payment method. If you set a return URL, then it would have to be added to the thing which displays the return URL (it could be anything on your website so hard to say exactly).

The following user(s) said Thank You: [oloccina](/forum/user/23273-oloccina "View oloccina's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL3Byb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTcwNzYtaG93LXRvLWNoZWNrLWNvbXBsZXRlZC1wYXltZW50cy13aXRoLWZhY2Vib29rLXBpeGVsP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[oloccina](/forum/user/23273-oloccina "View oloccina's Profile")**
- [![oloccina's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar23273.jpg)](/forum/user/23273-oloccina "View oloccina's Profile") Topic Author
- [ Offline](/forum/user/23273-oloccina)

Less More

- Posts: 224
- Thank you received: 8
-
-

7 years 7 months ago [\#305130](#305130) by [oloccina](/forum/user/23273-oloccina "View oloccina's Profile")  Replied by *[oloccina](/forum/user/23273-oloccina "View oloccina's Profile")* on topic *[How to check completed payments with facebook pixel?](/forum/26-product-category-display/897076-how-to-check-completed-payments-with-facebook-pixel#305130 "Hello, is there a way to check completed payments with facebook pixel?  And if yes, in which file exactly should I paste the pixel code among the view files? maybe checkout &gt; end or checkout &gt; after&#95;end  ?  Thank you")*

Hello,
I have read those topics and I remain with just one doubt.

So I have this code to insert in the checkout &gt; after_end file
Code:

&lt;script&gt; fbq('track', 'Purchase', { value: &lt;?php echo $this-&gt;order-&gt;order_full_price; ?&gt;, currency: 'EUR', }); &lt;/script&gt;

and Code:

&lt;?php echo $this-&gt;order-&gt;order_full_price; ?&gt;

should correctly show the total paid by the client

but if I insert that code in a custom return page (not the checkout &gt; after_end file) will still hikashop be able to print that line of code?

Thank you

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL3Byb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTcwNzYtaG93LXRvLWNoZWNrLWNvbXBsZXRlZC1wYXltZW50cy13aXRoLWZhY2Vib29rLXBpeGVsP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86358
- Thank you received: 14293
-
-

7 years 7 months ago [\#305152](#305152) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to check completed payments with facebook pixel?](/forum/26-product-category-display/897076-how-to-check-completed-payments-with-facebook-pixel#305152 "Hello, is there a way to check completed payments with facebook pixel?  And if yes, in which file exactly should I paste the pixel code among the view files? maybe checkout &gt; end or checkout &gt; after&#95;end  ?  Thank you")*

Hi,

No, it won't work as you don't have anything in $this-&gt;order in other pages.
you would have do add such code before to load HikaShop and load $this-&gt;order: Code:

&lt;?php if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR); if(!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')) return true; $order_id = hikaInput::get()-&gt;getInt('order_id'); if(empty($order_id)) { $app = JFactory::getApplication(); $order_id = $app-&gt;getUserState('com_hikashop.order_id'); } $this-&gt;order = null; if(!empty($order_id)) { $orderClass = hikashop_get('class.order'); $this-&gt;order = $orderClass-&gt;loadFullOrder($order_id, false, true); } ?&gt;

The following user(s) said Thank You: [oloccina](/forum/user/23273-oloccina "View oloccina's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL3Byb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTcwNzYtaG93LXRvLWNoZWNrLWNvbXBsZXRlZC1wYXltZW50cy13aXRoLWZhY2Vib29rLXBpeGVsP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[oloccina](/forum/user/23273-oloccina "View oloccina's Profile")**
- [![oloccina's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar23273.jpg)](/forum/user/23273-oloccina "View oloccina's Profile") Topic Author
- [ Offline](/forum/user/23273-oloccina)

Less More

- Posts: 224
- Thank you received: 8
-
-

7 years 7 months ago [\#305156](#305156) by [oloccina](/forum/user/23273-oloccina "View oloccina's Profile")  Replied by *[oloccina](/forum/user/23273-oloccina "View oloccina's Profile")* on topic *[How to check completed payments with facebook pixel?](/forum/26-product-category-display/897076-how-to-check-completed-payments-with-facebook-pixel#305156 "Hello, is there a way to check completed payments with facebook pixel?  And if yes, in which file exactly should I paste the pixel code among the view files? maybe checkout &gt; end or checkout &gt; after&#95;end  ?  Thank you")*

Thank you!

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL3Byb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTcwNzYtaG93LXRvLWNoZWNrLWNvbXBsZXRlZC1wYXltZW50cy13aXRoLWZhY2Vib29rLXBpeGVsP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[oloccina](/forum/user/23273-oloccina "View oloccina's Profile")**
- [![oloccina's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar23273.jpg)](/forum/user/23273-oloccina "View oloccina's Profile") Topic Author
- [ Offline](/forum/user/23273-oloccina)

Less More

- Posts: 224
- Thank you received: 8
-
-

7 years 7 months ago [\#305160](#305160) by [oloccina](/forum/user/23273-oloccina "View oloccina's Profile")  Replied by *[oloccina](/forum/user/23273-oloccina "View oloccina's Profile")* on topic *[How to check completed payments with facebook pixel?](/forum/26-product-category-display/897076-how-to-check-completed-payments-with-facebook-pixel#305160 "Hello, is there a way to check completed payments with facebook pixel?  And if yes, in which file exactly should I paste the pixel code among the view files? maybe checkout &gt; end or checkout &gt; after&#95;end  ?  Thank you")*

Is it normal that I receive a 404 error and this message

**0 Using $this when not in object context**

when visiting the page where I have inserted the code not actually coming back from Paypal?

see: [ accademiainfinita.it/ordine-online-confermato](https://accademiainfinita.it/ordine-online-confermato)

this is the code in the page (apart some text below it)
Code:

&lt;?php if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR); if(!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')) return true; $order_id = hikaInput::get()-&gt;getInt('order_id'); if(empty($order_id)) { $app = JFactory::getApplication(); $order_id = $app-&gt;getUserState('com_hikashop.order_id'); } $this-&gt;order = null; if(!empty($order_id)) { $orderClass = hikashop_get('class.order'); $this-&gt;order = $orderClass-&gt;loadFullOrder($order_id, false, true); } ?&gt; &lt;script&gt; fbq('track', 'Purchase', { value: &lt;?php echo $this-&gt;order-&gt;order_full_price; ?&gt;, currency: 'EUR', }); &lt;/script&gt;

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL3Byb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTcwNzYtaG93LXRvLWNoZWNrLWNvbXBsZXRlZC1wYXltZW50cy13aXRoLWZhY2Vib29rLXBpeGVsP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86358
- Thank you received: 14293
-
-

7 years 7 months ago [\#305162](#305162) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to check completed payments with facebook pixel?](/forum/26-product-category-display/897076-how-to-check-completed-payments-with-facebook-pixel#305162 "Hello, is there a way to check completed payments with facebook pixel?  And if yes, in which file exactly should I paste the pixel code among the view files? maybe checkout &gt; end or checkout &gt; after&#95;end  ?  Thank you")*

Hi,

Well, it means that you're not inside a function inside a class object.
In that case, just replace $this-&gt;order by $order and it will work.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL3Byb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTcwNzYtaG93LXRvLWNoZWNrLWNvbXBsZXRlZC1wYXltZW50cy13aXRoLWZhY2Vib29rLXBpeGVsP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[oloccina](/forum/user/23273-oloccina "View oloccina's Profile")**
- [![oloccina's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar23273.jpg)](/forum/user/23273-oloccina "View oloccina's Profile") Topic Author
- [ Offline](/forum/user/23273-oloccina)

Less More

- Posts: 224
- Thank you received: 8
-
-

7 years 7 months ago -  7 years 7 months ago [\#305546](#305546) by [oloccina](/forum/user/23273-oloccina "View oloccina's Profile")  Replied by *[oloccina](/forum/user/23273-oloccina "View oloccina's Profile")* on topic *[How to check completed payments with facebook pixel?](/forum/26-product-category-display/897076-how-to-check-completed-payments-with-facebook-pixel#305546 "Hello, is there a way to check completed payments with facebook pixel?  And if yes, in which file exactly should I paste the pixel code among the view files? maybe checkout &gt; end or checkout &gt; after&#95;end  ?  Thank you")*

Thank you,
I have tested this and can record payments in facebook, but not the value of them

since the format requested from FB is similar to
*value: 123.00*

I wonder if
*value: &lt;?php echo $order-&gt;order\_full\_price; ?&gt;*
returns this kind of format: XX.XX

thank you

Last edit: 7 years 7 months ago by [oloccina](/forum/user/23273-oloccina "View oloccina's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL3Byb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTcwNzYtaG93LXRvLWNoZWNrLWNvbXBsZXRlZC1wYXltZW50cy13aXRoLWZhY2Vib29rLXBpeGVsP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86358
- Thank you received: 14293
-
-

7 years 7 months ago [\#305547](#305547) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to check completed payments with facebook pixel?](/forum/26-product-category-display/897076-how-to-check-completed-payments-with-facebook-pixel#305547 "Hello, is there a way to check completed payments with facebook pixel?  And if yes, in which file exactly should I paste the pixel code among the view files? maybe checkout &gt; end or checkout &gt; after&#95;end  ?  Thank you")*

Hi,

You can use such code instead for that:
&lt;?php echo round($order-&gt;order_full_price,2); ?&gt;

The following user(s) said Thank You: [oloccina](/forum/user/23273-oloccina "View oloccina's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL3Byb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTcwNzYtaG93LXRvLWNoZWNrLWNvbXBsZXRlZC1wYXltZW50cy13aXRoLWZhY2Vib29rLXBpeGVsP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[oloccina](/forum/user/23273-oloccina "View oloccina's Profile")**
- [![oloccina's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar23273.jpg)](/forum/user/23273-oloccina "View oloccina's Profile") Topic Author
- [ Offline](/forum/user/23273-oloccina)

Less More

- Posts: 224
- Thank you received: 8
-
-

7 years 6 months ago -  7 years 6 months ago [\#305851](#305851) by [oloccina](/forum/user/23273-oloccina "View oloccina's Profile")  Replied by *[oloccina](/forum/user/23273-oloccina "View oloccina's Profile")* on topic *[How to check completed payments with facebook pixel?](/forum/26-product-category-display/897076-how-to-check-completed-payments-with-facebook-pixel#305851 "Hello, is there a way to check completed payments with facebook pixel?  And if yes, in which file exactly should I paste the pixel code among the view files? maybe checkout &gt; end or checkout &gt; after&#95;end  ?  Thank you")*

I have tested for some days the code you suggested

&lt;?php echo round($order-&gt;order_full_price,2); ?&gt;

but it seems that is still printing a total value like this XX
see [ nimb.ws/CiKnMN](https://nimb.ws/CiKnMN)

while Facebook for what I understand want something like this XX.YY
for example it wants 77.00 and not 77

this is what Facebook sees right now for an order of 77 €

{"value":"77","currency":"EUR"}

and this is the code I am using
Code:

&lt;?php if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR); if(!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')) return true; $order_id = hikaInput::get()-&gt;getInt('order_id'); if(empty($order_id)) { $app = JFactory::getApplication(); $order_id = $app-&gt;getUserState('com_hikashop.order_id'); } $order = null; if(!empty($order_id)) { $orderClass = hikashop_get('class.order'); $order = $orderClass-&gt;loadFullOrder($order_id, false, true); } ?&gt; &lt;script&gt; fbq('track', 'Purchase', { value: &lt;?php echo round($order-&gt;order_full_price,2); ?&gt;, currency: 'EUR', }); &lt;/script&gt;

anything else I could try to get this correctly?

Thank you

Last edit: 7 years 6 months ago by [Jerome](/forum/user/80-jerome "View Jerome's Profile"). Reason: indent code

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL3Byb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTcwNzYtaG93LXRvLWNoZWNrLWNvbXBsZXRlZC1wYXltZW50cy13aXRoLWZhY2Vib29rLXBpeGVsP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86358
- Thank you received: 14293
-
-

7 years 6 months ago [\#305870](#305870) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to check completed payments with facebook pixel?](/forum/26-product-category-display/897076-how-to-check-completed-payments-with-facebook-pixel#305870 "Hello, is there a way to check completed payments with facebook pixel?  And if yes, in which file exactly should I paste the pixel code among the view files? maybe checkout &gt; end or checkout &gt; after&#95;end  ?  Thank you")*

Hi,

If you want exactly 2 decimals, then you want to user the number_format function instead:
&lt;?php echo number_format($order-&gt;order_full_price, 2, '.', ''); ?&gt;

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL3Byb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTcwNzYtaG93LXRvLWNoZWNrLWNvbXBsZXRlZC1wYXltZW50cy13aXRoLWZhY2Vib29rLXBpeGVsP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.068 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
