Sales report issue with API

Highlighted
Shopify Partner
1 0 0

I am working with shopify API to fetch weekly sales. But sales is fluctuating. When I check today's sales through API it's coming perfect.

Here is sample code:

final_price = 0

order_count = ShopifyAPI::Order.count({:created_at_min => Time.zone.now.at_beginning_of_week.iso8601, :status => "any"})

puts "Order Count is =====#{order_count}========"

nb_pages = (order_count / 250.0).ceil

1.upto(nb_pages) do |page|

@Orders = ShopifyAPI::Order.find(:all, :params => {:limit => 250, :created_at_min => Time.zone.now.at_beginning_of_week.iso8601,:page => page,:status => "any"})

@Orders.each do |order|

final_price += order.total_price.to_f

end

end


This is ror code. Any help is would be appreciated. Thanks in advance. 

   

0 Likes
Shopify Staff
Shopify Staff
383 53 62

Hey @Shekhar,

 

But sales is fluctuating

Can you please elaborate? I suspect beginning_of_week is Monday, 00:00. So your final_price should increase as orders arrive.

 

0 Likes