Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Add State alongside City (and other customer info). #2463
Adds an oddly missing State data point when it currently has Country, City, and Postal Code. I have a client with State-based campaigns, currently, so them not having that one data point is something that could/should be addressed for them and others.
Why would State not be included as a possible data point in the reporting if it's not shown by default (similar to City)?
I simply added a new data point based off of the existing City field so its accessibility qualities should carry over appropriately.
Enhancement: add state/region to Customers Report. 👏🏻 @KZeni
joshuatf left a comment
Awesome- thanks for this addition, @KZeni!
There's one more update that needs to be made for tests to pass; changing
Could you make that change if you get a chance?
Also, I think the decision to leave out state may have been intentional since many countries don't have "states." This is probably okay since we can toggle off this column easily though. /cc @LevinMedia @jameskoster for your thoughts.
I can see that, but WooCommerce itself has State as a data point with accompanying functions for processing it, etc. accordingly. So I really think it should be able to be surfaced if it's wanted/needed. For those that sell mostly/exclusively in the US; having State included is a must-have for location information.
Just because it isn't always present doesn't mean it shouldn't be available. For example, "Why have a Coupon column for the order report if some orders don't have coupons?" would apply to the reasoning for not including state/province.
As an aside, I could certainly see the "State" column's name changed to "State/Province" to be more widely applicable if that's a hangup.
joshuatf left a comment
Thanks for those changes @KZeni! I'll go ahead and approve this and we can make any changes in a follow-up.
This is a good idea and will probably resolve any lingering issues between stores/orders. @jameskoster Do you have an opinion on this?
@jameskoster As @KZeni noted (thanks!), this would be a column in the Customers report. Stores that don't need this can toggle the column off as needed. A label of
I did a little bit of digging, turns out there's quite the variety in what countries call their various administrative divisions. I think using "Region" would be a little more inclusive than even "State / Province", it's also less letters. (Even thought this is what some countries call their version of a state.)
This is the pattern Google Analytics follows as well: Country > Region > City
[Status] In Progress
[Status] Needs Design Review
[Status] Ready to Merge
Jun 28, 2019
I renamed the label in the table and API to be "Region" instead of "State". I kept it as "state" behind the scenes since WooCommerce itself considers this as state in its functions, keys, filters, etc. That way, it's consistent with WooCommerce's conventions while having the label be more appropriate for when it's shown.