Want to customize the sold item section PFA

Solved

Want to customize the sold item section PFA

naveen1989
Shopify Partner
14 0 0

HI Members, 

 

I am using Empire theme for me site https://dreamzhub.in/collections/home-accessories/products/multifunctional-mandoline-slicer . This theme don't have much option to design the product page. So i want to use some custom code. 

I want to change the item sold last 10 days  section. 

In this section i want to show random numbers like 30 40 55 sold in last hour or 2 hours like this. Don't want to show actual value in last 10 days. 

 

Thanks in Advance.

 

 

aaa.png

Accepted Solution (1)

gr_trading
Shopify Partner
1899 145 199

This is an accepted solution.

Hi @naveen1989 

 

Use the below script to implement the same, put this code in main-product.liquid at the appropriate location.

 

<div>Item sold last <span id="_ordercount"></span> days  section.</div>

 

Below script at the bottom of liquid file.

 

<script>
let x = Math.floor((Math.random() * 100) + 1);
document.getElementById("_ordercount").innerHTML = x;
</script>

 

This will return the value between 1-100, you can change the value.

 

hope this will help...

For any custom development WhatsApp or connect at Email ID: gr.trading15@gmail.com for quick consultation. | Shopify Free codes
To support Buy Me a Coffee

View solution in original post

Replies 4 (4)

dbuglab
Shopify Partner
473 51 50

Hi @naveen1989 

You an do this using javascript, while refresh javascript will fetch the random number between the given numbers.

banned
naveen1989
Shopify Partner
14 0 0

can you please share the code ?

gr_trading
Shopify Partner
1899 145 199

This is an accepted solution.

Hi @naveen1989 

 

Use the below script to implement the same, put this code in main-product.liquid at the appropriate location.

 

<div>Item sold last <span id="_ordercount"></span> days  section.</div>

 

Below script at the bottom of liquid file.

 

<script>
let x = Math.floor((Math.random() * 100) + 1);
document.getElementById("_ordercount").innerHTML = x;
</script>

 

This will return the value between 1-100, you can change the value.

 

hope this will help...

For any custom development WhatsApp or connect at Email ID: gr.trading15@gmail.com for quick consultation. | Shopify Free codes
To support Buy Me a Coffee
naveen1989
Shopify Partner
14 0 0