Facebook Pixel Tracking on RestroPress WordPress

Track Sales From RestroPress on WordPress so you can get a good perspective on your Facebook ad sales.

These are the code snippets you need to add to your website to start tracking sales on Facebook. 

First, you need a place to add in your header and footer I like this plugin to do so: https://wordpress.org/plugins/insert-headers-and-footers/ 

In the header add the regular Facebook pixel. 

and on the footer add the following section

<script>
jQuery( document ).ready(function() {
    var amount = jQuery('.rpress_cart_total_row .rp-amount-right').text().replace("$", "");;
	console.log(amount);
	if(amount){
		fbq('track', 'Purchase', {currency: "USD", value: amount});
	}
});
</script>

This checks the amount on an element and tracks the purchase event only if the amount is found.