The reason I love Shopify is for its simple integration of Facebook Pixel and Google Analytics. You can yourself install the Facebook pixel without hiring an expert. But still, there is an issue with the Facebook add to cart event when it comes to ajax add to cart buttons.
This is a very serious problem for many Shopify users and I didn’t find a reliable solution on the internet. So I thought of presenting you a simple and reliable solution to fix the issue.
What’s the issue?
If you are unable to see the Facebook add to cart event, chances are you are using Ajax add to cart button on your site. But how do you know if it’s Ajax? Click on the add to cart button, if the page doesn’t reload on add to cart click, it’s an Ajax button. You will not see the add to cart event firing in the pixel helper.
How to fix?
All you have to do is to add a simple add to cart custom code to your Shopify website. Follow the below steps:
1. Log in to your Shopify Account
2. Click on themes under Online Store from the left menu
3. Click on actions >> edit code
4. Find ‘product-template-liquid’ file using the search and open it
5. Copy the below code and paste it on the end of the above file
6. Save the file.
Open a product detail page and click add to cart button. You will now see the add to cart event firing.
If you have the add to cart button added on other pages, make sure to add the same code on those pages as well.
I hope this will work for 99% of the Shopify users. If for some reason this isn’t working for you, you can hire me.