Solved

Where should I paste the Pinterest Add to Cart event code in Shopify?

j_stan
Visitor
1 0 0

Hi all!

 

I'm trying to set up Pinterest conversion tracking codes, so I just pasted a Pinterest base tag & Checkout Event to the theme.liquid file & checkout settings, however, I also want to add the Add To Cart event code, but I was not able to do it with the help of the official instructions since I couldn't find a line of code where I needed to pass the Add to Cart code. Can you tell me exactly where I should paste the code?

 

Instructions that I was looking at were these (Step 3) : 

https://help.pinterest.com/en/business/article/shopify-and-pinterest-tag

 

In my current code that I have in my product.liquid I couldn't find addtocart section where I need to input the Pinterest code. I talked to a support agent on chat and he pointed me out here.  FYI Im using the Brooklyn theme.

If there is more info you need let me know. Any help would be highly appreciated. Thanks!

Accepted Solution (1)

SBD_
Shopify Staff
1829 269 405

This is an accepted solution.

Hey @j_stan,

 

Adapting their instructions to the Brooklyn theme, you can add the `onclick` attribute to the submit button (around line 311 of sections/product-template.liquid on a fresh theme).

 

<button type="submit" name="add"...

 

Would become:

 

<button onclick="pintrk('track', 'addtocart');" type="submit" name="add"...

 

 

Scott | Developer Advocate @ Shopify 

View solution in original post

Replies 24 (24)

SBD_
Shopify Staff
1829 269 405

This is an accepted solution.

Hey @j_stan,

 

Adapting their instructions to the Brooklyn theme, you can add the `onclick` attribute to the submit button (around line 311 of sections/product-template.liquid on a fresh theme).

 

<button type="submit" name="add"...

 

Would become:

 

<button onclick="pintrk('track', 'addtocart');" type="submit" name="add"...

 

 

Scott | Developer Advocate @ Shopify 

AlexKptv
Visitor
1 0 0

Hi. Same question, but for PageFly theme, please. Thank you.

SBD_
Shopify Staff
1829 269 405

@AlexKptv, please reach out to PageFly support.

Scott | Developer Advocate @ Shopify 

Max95
Visitor
2 0 1

Hey I have the same issue - I followed all steps on here: https://help.pinterest.com/en/business/article/manually-add-shopify-tag except the last one with the Addtocart Button. I am using the Narrative Theme and I cannot find the button anywhere. Please help me solve this!

Regards Max

davidezurigo
Visitor
1 0 0

Hi all, 

 

same goes for me, I don't understand how to add the code for the "AddtoCart". I have the minimal theme - can someone help please?

 

Thanks,
David

 

outdoordining
New Member
4 0 0

 Same issue with minimal theme

artesdelmundo
Visitor
2 0 0

Same issue with Prestige theme tracking checkouts.

I get an overall health of my Pinterest tag of unhealthy because there is no checkout event firing.  Where do I put the code to track checkouts/conversions in Prestige?  I was instructed to find the addtocart function in product.liquid but it's not there.

outdoordining
New Member
4 0 0
This has absolutely NOTHING to do with my store
jonhinu
Visitor
2 0 2

For the checkout you should add it to the Setting -> Checkout and add the checkout code in the additional scripts section. For the add to cart you have to go to Online Store -> Themes -> Edit Code and search product-form.liquid on the Snippets section.

Then you ctrl+F and search:

 

<button type="submit" class="ProductForm__AddToCart Button

 

Once you have it you should add onclick="pintrk('track', 'addtocart');" to the code so it will look like:

 

<button onclick="pintrk('track', 'addtocart');" type="submit" class="ProductForm__AddToCart Button...

 

 

UNIVERSUM
Tourist
4 0 1

I am really struggling to find the add to cart button for my theme. I've checked and searched product-template.liquid, product-form.liquid but nothing...

Any idea where it would be?

AbddToulouse
Visitor
2 0 0

Wokrs like charm, thx !

 

cbfs
Tourist
3 0 1

I'm using the narrative theme as well, did you manage to solve it?

cyclists-com
Tourist
3 0 1

Hi. Would be grateful to know how to add the pinterest tracking code in the product.liquid file;

 

In my theme the addtocart code looks like this;

 

var $addToCartForm = $('form[action="/cart/add"]');

 

The Pinterest code to add is onclick="pintrk('track', 'addtocart');"

 

I didn't want to break it but unsure how to add it correctly. Thanks

MathiasW
Excursionist
16 1 7

I would appreciate help for Cascade theme. I also cannot find the addtocart. In product.liquid template there is an indication to look for section product.liquid, but there is nothing really. Would be good for Shopify to provide more support on integrating with Pinterest!

 

 

RSH
Visitor
2 0 0

I've been working with Pinterest support and have not been able to get my add to cart code correct. I'm using the Shopify Theme Debut and placing the code on line 211 as their instructions:  data-add-to-cart onclick="pintrk('track', 'addtocart');"

 

The add to cart fires; however, it gives off 2 errors.

  1. No enhanced match was found 
  2. Value is missing

# 2 is an issue and will not allow me to proceed to be verified on the Pinterest platform.

greenlee
Visitor
1 0 0

Hi there, I am using a streamline theme. I met the same problem of Pinterest add to cart event code. Can you help plz?

Thanks a lot.

Zoe14
New Member
6 0 0

Hi. Same question, but for Kalles theme, please. Thank you.

mzie25
Visitor
2 0 0

Hi! I just want to ask if this solution is also applicable to the craft theme? I’m having the same issues as well with the Pinterest addtocart event. I can’t seem to find where to put the code.

chathu23
Visitor
2 0 1

for Dawn theme please..

harsh300969
Tourist
8 0 1

. I am trying to add Pinterest addToCart event code manually, but I cannot find the addtoCart section on the theme.liquid or main-product.liquid file and i have tried searching for the custom.js file too but didn't find that as well. I have tried reaching out for help on shopify community.

I am using the Studio theme

shaunacarlisle
Visitor
2 0 0

Hi, did you manage to install the addToCard event code already ? I'm also using the Studio theme, can't find it;

harsh300969
Tourist
8 0 1

I couldn't find a way to manually add the addToCart event code, so I changed my store location and installed the Pinterest app from the Shopify store. After that, I reverted the location back to its original setting, and everything worked smoothly, including the tags.

shaunacarlisle
Visitor
2 0 0

Hi Harsh300969, thank you for your reply! What exactly do you mean with 'I changed my store location' and then you reverted the location back? 

 

bandg
Tourist
3 0 0

how do you change the store location, I'm thinking of doing that as well!