• Resolved schlawiener

    (@schlawiener)


    hi all,
    i’m running a little shop for a small community and am at the end of my coding capabilities (low) at the moment.
    the shop is not open to the public, so i can’t add a link, my apologies.
    now my problem is that i need a list overview of all products with the summed up quantities of last weeks orders. i wasn’t able to find a plugin or a snippet on the net.
    what i found is the following

    that’s very useful to me, too. it prints all orders of a specified timerange with products and quantities.
    enhance it with a summing function and i’m in heaven… ??
    please advise with a bit of code or a link that does the trick.
    thanks!!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    This code is pretty out of date but what you’d need to do is have a varaible before the snippet ($grand_total = 0;) and then each loop add the order total to that. After the loop you can then echo the $grand_total.

    Not sure why you need this though; the reporting section can be used instead?

    Thread Starter schlawiener

    (@schlawiener)

    hi mike,
    thank you so much for your reply.
    i can’t use the reporting function, cause what i get there is a sum of all products sold. what i do need is the sum for each product of all orders. i think i wasn’t too clear on that before.
    Now while looping through all orders, i don’t really know how to access the products and quantities of a specific order. in the snippet a function called email_order_items_table() is used, but i don’t understand it.
    do you have a hint for me how to access products and their corresponding quantities of the orders?

    why do i need this? we’re running a community where people order veggies each week (basically for free, so prices of all products are zero ?? ). now our gardeners need to print a list of the weeks orders summed up for each product to go picking. they are not keen to handle online shops or csv downloads, so my idea was to have the information neatly on a site, or even send it to them via email.

    thanks!!

    Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    Get items within each order with https://docs.woothemes.com/wc-apidocs/class-WC_Abstract_Order.html#_get_items which can again be looped over.

    If you’re wanting to do this to output products though thats more advanced since products are inside orders and I presume you need some kind of relationship between product and person seeing the report.

    If you need help building custom reports for this purpose I’d suggest getting a developer via jobs.wordpress.net to help.

    Thread Starter schlawiener

    (@schlawiener)

    hi mike,
    get_items did the trick for me, thank you so much!
    regards

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘sum up product quantities of last weeks orders’ is closed to new replies.