FROM CACHE - en_header

Display top 3 customer details with photo in homepage dawn theme

Aravinthmoshi
Shopify Partner
16 0 4

Hi All,

 

I want to display the top 3 customer details with photo in homepage(Based on the order they completed). I am using dawn theme.. is it possible to do ?? Can anyone pls help me on that..

 

 

thanks

Replies 7 (7)
oscprofessional
Shopify Partner
12165 1885 2421

Hello @Aravinthmoshi ,

You want to say that you want to show Customer testimonials in Home page?

Please Like and Accept Solution. Free website audit to grow your business Chat on WhatsApp | Email: pallavi@oscprofessionals.com | Skype : oscprofessionals-87 | Hire us | Expert Site Speed Optimization | Performance Site Audit | Shopify Private App | Custom Theme Development & Modifications any Shopify Theme | Shopify SEO | Digital Marketing
Aravinthmoshi
Shopify Partner
16 0 4

No. Based on their products purchased ranking(orders placed in website), need to display the top 3 customer details with photo in homepage.

 

Thanks.

oscprofessional
Shopify Partner
12165 1885 2421

@Aravinthmoshi ,

Can you share the store URL ?? so that I can check and let you know!

Have a Nice Day!

Please Like and Accept Solution. Free website audit to grow your business Chat on WhatsApp | Email: pallavi@oscprofessionals.com | Skype : oscprofessionals-87 | Hire us | Expert Site Speed Optimization | Performance Site Audit | Shopify Private App | Custom Theme Development & Modifications any Shopify Theme | Shopify SEO | Digital Marketing
Aravinthmoshi
Shopify Partner
16 0 4

Thanks for your response.

 

store url: https://northmistnew.myshopify.com/

pwd:northmist

Aravinthmoshi
Shopify Partner
16 0 4

In that homepage, leaderboard section- need to show the top ranked customer details.

 

thank you.

SheetalZadfiya
Explorer
70 14 11

Hi @Aravinthmoshi 

 

To display top 3 customer details you need to add below code in to your section.

Display customer image shopify does not provide option for add customer image.

 

Create new file and add below code. Use this section where you want to display top 3 customers.

 

<div class="top_customer">
  <div class="container">
    <div class="top_customer_block"></div>
  </div>
</div>
<script>
  $(document).ready(function(){
    var ajax = {
      type: "GET",
      url: "/admin/api/2022-04/customers/search.json?order=orders_count",	
      dataType: "json",
      success: function(data){
        console.log(data,'data');
        let allData = data.customers;
        let getJson = []; 
        getJson.push(allData);
        $.each(getJson,function(num,value){
          let mainHtml = '';
          $.each(value,function(i,val){
            if(val.orders_count > 0){
              let state = val.state;
              if(state != 'disabled'){
                if (i > 3)
                  return false;
                mainHtml += '<div>';
                mainHtml += '<div class="customer_img"></div>'
                mainHtml += '<h2>'+ val.first_name +'  '+ val.last_name +'</h2>';
                mainHtml += '<p>'+ val.email +'</p>';
                mainHtml += '</div>';
                $('.top_customer_block').html(mainHtml);
              }
            }
          });
        });
      },
      error: function(){
        console.log('error');
      }
    };
    $.ajax(ajax);
  });
</script>

{% schema %}
  {
    "name": "Top Customer",
    "settings": [],
	"presets":[
      {
      	"name": "Top Customer"
      }
	]
  }
{% endschema %}

{% stylesheet %}
{% endstylesheet %}

{% javascript %}
{% endjavascript %}

 

 

Thank You.

If our answer is helpful then please feel free to Like and Accept it as solution!
Hire our Shopify Developers for all your small & big needs:
New Store Development | Custom Theme Development | Site Speed Optimization
Email: hello@mintyourstore.com | Instagram: @mintyourstore
Aravinthmoshi
Shopify Partner
16 0 4

@SheetalZadfiya Thanks for your code.. I have tried your code, But it is not working for me.. can you pls help me out on this?

 

 

Thanks,

Aravinth.