Title: Group by Zip code
Last modified: September 8, 2021

---

# Group by Zip code

 *  Resolved [jumptech](https://wordpress.org/support/users/jumptech/)
 * (@jumptech)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/group-by-zip-code/)
 * Hi
    I’m trying your pro version demo to evalute the plugin purchase. I need to
   export a report where there is a group by with the zipcode.
 * I would like to have this output:
 * ZIP Code | Quantity | Product
 * So, if in a month two users with the same zipcode (example: 47121) buy product
   X (1 product each), I would like to see, in my output:
 * ZIP Code | Quantity | Product
    47121 | 2 | X
 * If:
    – user 1 (zipcode 47121) buy 1 product A and 1 product B – user 2 (zipcode
   47121) buy 1 product B – user 3 (zipcode 65311) buy 1 product A
 * my output will be
 * ZIP Code | Quantity | Product
    47121 | 2 | B 47121 | 1 | A 65311 | 1 | A
 * Is it possible to do this?
    Thanks

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/group-by-zip-code/#post-14851556)
 * Hi
 * 1. please, turn on ” Summary Report By Products”
    2. add field “zipcode” as described
   in [https://docs.algolplus.com/algol_order_export/add-calculated-field-for-product/](https://docs.algolplus.com/algol_order_export/add-calculated-field-for-product/)
   3. add this code to section “Misc Settings”
 *     ```
       add_filter( "woe_summary_products_adjust_key", function($key, $product, $product_item, $order ){
         return $order->get_billing_postcode();
       },10,4);
       add_filter('woe_get_order_product_value_zipcode', function ($value, $order, $item, $product,$item_meta) {
         return $order->get_billing_postcode();
       }, 10, 5);
       ```
   
 *  Thread Starter [jumptech](https://wordpress.org/support/users/jumptech/)
 * (@jumptech)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/group-by-zip-code/#post-14853954)
 * hi
 * Thank you for the reply.
 * Doing as you said produce a wrong output.
 * all the quantities are added together and instead of two rows (one for each products)
   I have only one row with the total quantity of the purchased products, also if
   the product it’s not the one mentioned in the row.
 * Maybe I’ve created zipcode wrong?
    If I select ” Summary Report By Products” 
   I can only create a zipcode field like that [https://drive.google.com/file/d/1iobILoTXhPZuyd4hhG5FTmGcG9S7QPQv/view?usp=sharing ](https://drive.google.com/file/d/1iobILoTXhPZuyd4hhG5FTmGcG9S7QPQv/view?usp=sharing)
 *  Thread Starter [jumptech](https://wordpress.org/support/users/jumptech/)
 * (@jumptech)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/group-by-zip-code/#post-14853963)
 * [submit by error]
    -  This reply was modified 4 years, 8 months ago by [jumptech](https://wordpress.org/support/users/jumptech/).
 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/group-by-zip-code/#post-14854131)
 * Yes, you added new field correctly.
 * Could you try this code ?
 *     ```
       add_filter( "woe_summary_products_adjust_key", function($key, $product, $product_item, $order ){
         return $key . $order->get_billing_postcode();
       },10,4);
       add_filter('woe_get_order_product_value_zipcode', function ($value, $order, $item, $product,$item_meta) {
         return $order->get_billing_postcode();
       }, 10, 5);
       ```
   
    -  This reply was modified 4 years, 8 months ago by [algol.plus](https://wordpress.org/support/users/algolplus/).
 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/group-by-zip-code/#post-14854179)
 * please, use “Add static field” [https://imgur.com/4V4JqA9](https://imgur.com/4V4JqA9)
   
   and use this code
 *     ```
       add_filter('woe_get_order_product_value_static_field_2', function ($value, $order, $item, $product,$item_meta) {
         return $order->get_billing_postcode();
       }, 10, 5);
       ```
   
 *  Thread Starter [jumptech](https://wordpress.org/support/users/jumptech/)
 * (@jumptech)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/group-by-zip-code/#post-14854291)
 * Thank you so much! this works!!
    -  This reply was modified 4 years, 8 months ago by [jumptech](https://wordpress.org/support/users/jumptech/).
 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/group-by-zip-code/#post-14854320)
 * just replace get_billing_postcode with get_shipping_postcode
 *  Thread Starter [jumptech](https://wordpress.org/support/users/jumptech/)
 * (@jumptech)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/group-by-zip-code/#post-14854330)
 * Yes I’ve done this after I’ve asked you ^^”
    I’ll give you 5 stars and I’ll buy
   your plugin asap.
 * Thank you again
 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/group-by-zip-code/#post-14854350)
 * you’re welcome!

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Group by Zip code’ is closed to new replies.

 * ![](https://ps.w.org/woo-order-export-lite/assets/icon-256x256.png?rev=1365554)
 * [Advanced Order Export For WooCommerce](https://wordpress.org/plugins/woo-order-export-lite/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woo-order-export-lite/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woo-order-export-lite/)
 * [Active Topics](https://wordpress.org/support/plugin/woo-order-export-lite/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woo-order-export-lite/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woo-order-export-lite/reviews/)

## Tags

 * [group by](https://wordpress.org/support/topic-tag/group-by/)

 * 9 replies
 * 2 participants
 * Last reply from: [algol.plus](https://wordpress.org/support/users/algolplus/)
 * Last activity: [4 years, 8 months ago](https://wordpress.org/support/topic/group-by-zip-code/#post-14854350)
 * Status: resolved