How to change the position of percentage symbol

Emirus
Tourist
7 0 0

Hi everybody,

I'm trying to switch from 50% to %50 on product sale badges. I have minimal knowledge of coding and I couldn't find the correct line to edit in the files.

I found this line in theme.js but changing the position of (+'%') does nothing (or changing the % with anything else): 

var per = Math.round(100 - (_mainprice / compprice)*100)+'%';

Thanks a lot!

 

0 Likes
Syed_Mustafa
Shopify Partner
252 5 18

Can you please share your web link?

If helpful then please Like and Accept Solution.
Do you need custom changes on the store or want a complete speed optimization? Hire me.
Need a dropshipping expert or wants to alive your dead dropshipping store?
Feel free to contact me at Syedmustafanadeem99@gmail.com
0 Likes

Hey @Emirus ,

Try this please:

var per = '%'+Math.round(100 - (_mainprice / compprice)*100);

◦ Problem Solved? ✔️ Please click on Accept as Solution and like.
◦ Using a free theme? Improve it with copy/paste code snippets clicking here.
◦ Looking to hire an experienced developer? Same day response: ezfycode@gmail.com.
0 Likes
Emirus
Tourist
7 0 0

This does not work unfortunately.

0 Likes

@Emirus 

Hm, weird, it should. Can you please try this:

var per = `%${Math.round(100 - (_mainprice / compprice)*100)}`;

◦ Problem Solved? ✔️ Please click on Accept as Solution and like.
◦ Using a free theme? Improve it with copy/paste code snippets clicking here.
◦ Looking to hire an experienced developer? Same day response: ezfycode@gmail.com.
0 Likes
Emirus
Tourist
7 0 0

Not working either.

0 Likes

Can you send a screenshot of the code please?

◦ Problem Solved? ✔️ Please click on Accept as Solution and like.
◦ Using a free theme? Improve it with copy/paste code snippets clicking here.
◦ Looking to hire an experienced developer? Same day response: ezfycode@gmail.com.
0 Likes
Emirus
Tourist
7 0 0

code.png

0 Likes

Oh, it's not working because there are more instances of this code throughout the file.

If you press CTRL + F and search for: 

+'%'


do more lines show up?

If so, you'll need to change the code on all of them.


◦ Problem Solved? ✔️ Please click on Accept as Solution and like.
◦ Using a free theme? Improve it with copy/paste code snippets clicking here.
◦ Looking to hire an experienced developer? Same day response: ezfycode@gmail.com.
0 Likes
Emirus
Tourist
7 0 0

Changed all like in the screenshot below but nothing has changed.

code2.png

0 Likes