Where to place Yotpo Rewards pop-up code in theme?

I use Yotpo for my customer rewards & loyalty program. They have provided me with the coding that will cause the Rewards page to pop up when a customer logs into their account (as opposed to the customer having to click the Rewards button at the top right), but they won’t tell me where to place it in my theme.

Can anyone help?

This is the code they provided. The instructions say to use the portion of the code in red.

$(document).on(“swell:setup”, function(){ swellAPI.showPopupByType(“RewardsPopup”); });

You can try place this before ending tag in your theme.liquid file :


It tried. It didn’t work. :cry:

@Tri_S

You have to at least show url and where the popup appears for us to try to identify the issue.

I am off for now so hopefully someone can help.

Hi @Tri_S ,

You can add it at the bottom of the layout > theme.liquid file.

If it still doesn’t work, just change this code and paste it here:

Code:


    

Hope it helps!

Thank you!

The 2nd version worked!!

Opps! Correction. This didn’t work after all. It caused the pop up to trigger on every page of my site, not just the Account Login page.

Hi @Tri_S ,

You want to add it for login page only?

You just need to add the following code, it will work fine:

{%- if request.page_type == 'customers/login' -%}
	
    
{%- endif -%}

Hope it helps!

Thank you for your suggestion. Unfortunately, the last option creates a popup loop, never allowing me (as the customer to actually log in.

I’m ok with how things are now. I think if a customer really wants to use their Rewards points they’ll take the step to click the Rewards tab at the top of the page.

Thank you again for all of your coding offerings!!!

Hi @Tri_S ,

If it helped you solve your issue, please mark it as a solution. Thank you and good luck.