{"action":"created","issue":{"url":"https://api.github.com/repos/easydigitaldownloads/easy-digital-downloads/issues/5169","repository_url":"https://api.github.com/repos/easydigitaldownloads/easy-digital-downloads","labels_url":"https://api.github.com/repos/easydigitaldownloads/easy-digital-downloads/issues/5169/labels{/name}","comments_url":"https://api.github.com/repos/easydigitaldownloads/easy-digital-downloads/issues/5169/comments","events_url":"https://api.github.com/repos/easydigitaldownloads/easy-digital-downloads/issues/5169/events","html_url":"https://github.com/easydigitaldownloads/easy-digital-downloads/issues/5169","id":187852426,"number":5169,"title":"Only require state if the Country has states","user":{"login":"mintplugins","id":1638128,"avatar_url":"https://avatars.githubusercontent.com/u/1638128?v=3","gravatar_id":"","url":"https://api.github.com/users/mintplugins","html_url":"https://github.com/mintplugins","followers_url":"https://api.github.com/users/mintplugins/followers","following_url":"https://api.github.com/users/mintplugins/following{/other_user}","gists_url":"https://api.github.com/users/mintplugins/gists{/gist_id}","starred_url":"https://api.github.com/users/mintplugins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mintplugins/subscriptions","organizations_url":"https://api.github.com/users/mintplugins/orgs","repos_url":"https://api.github.com/users/mintplugins/repos","events_url":"https://api.github.com/users/mintplugins/events{/privacy}","received_events_url":"https://api.github.com/users/mintplugins/received_events","type":"User","site_admin":false},"labels":[{"id":2798126,"url":"https://api.github.com/repos/easydigitaldownloads/easy-digital-downloads/labels/Bug","name":"Bug","color":"fc2929","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/easydigitaldownloads/easy-digital-downloads/milestones/144","html_url":"https://github.com/easydigitaldownloads/easy-digital-downloads/milestones/2.6.12","labels_url":"https://api.github.com/repos/easydigitaldownloads/easy-digital-downloads/milestones/144/labels","id":2093310,"number":144,"title":"2.6.12","description":"","creator":{"login":"cklosowski","id":1390124,"avatar_url":"https://avatars.githubusercontent.com/u/1390124?v=3","gravatar_id":"","url":"https://api.github.com/users/cklosowski","html_url":"https://github.com/cklosowski","followers_url":"https://api.github.com/users/cklosowski/followers","following_url":"https://api.github.com/users/cklosowski/following{/other_user}","gists_url":"https://api.github.com/users/cklosowski/gists{/gist_id}","starred_url":"https://api.github.com/users/cklosowski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cklosowski/subscriptions","organizations_url":"https://api.github.com/users/cklosowski/orgs","repos_url":"https://api.github.com/users/cklosowski/repos","events_url":"https://api.github.com/users/cklosowski/events{/privacy}","received_events_url":"https://api.github.com/users/cklosowski/received_events","type":"User","site_admin":false},"open_issues":44,"closed_issues":0,"state":"open","created_at":"2016-10-25T20:20:49Z","updated_at":"2016-11-07T22:55:50Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2016-11-07T22:49:16Z","updated_at":"2016-11-07T23:01:42Z","closed_at":null,"body":"Currently, when taxes are enabled and the customer is in a country without states, state is still required. This would require anyone from the UK to fill in a fake state in order to complete their purchase. \r\n\r\nWe have a snippet in the library which disables the requirement for state but it would disable the requirement for countries which DO have states - which is not desirable for those countries.\r\n\r\nI have found a work around for the snippet where the state is disabled ONLY if no states exist. \r\n\r\n```\r\nfunction pw_edd_remove_state_from_required_fields( $fields ) {\r\n\r\n\t$states = edd_get_shop_states( $_POST['billing_country'] );\r\n\r\n\tif( array_key_exists( 'card_state', $fields ) && empty( $states ) ) {\r\n\t\tunset( $fields['card_state'] );\r\n\t}\r\n\treturn $fields;\r\n}\r\nadd_filter( 'edd_purchase_form_required_fields', 'pw_edd_remove_state_from_required_fields' );\r\n```\r\n\r\nI feel this should be default functionality for EDD as no one would (by default) want to require customers to fill in a state when no states actually exist for them. \r\n\r\nProposal:\r\nOnly require state if the country has states."},"comment":{"url":"https://api.github.com/repos/easydigitaldownloads/easy-digital-downloads/issues/comments/258991610","html_url":"https://github.com/easydigitaldownloads/easy-digital-downloads/issues/5169#issuecomment-258991610","issue_url":"https://api.github.com/repos/easydigitaldownloads/easy-digital-downloads/issues/5169","id":258991610,"user":{"login":"mintplugins","id":1638128,"avatar_url":"https://avatars.githubusercontent.com/u/1638128?v=3","gravatar_id":"","url":"https://api.github.com/users/mintplugins","html_url":"https://github.com/mintplugins","followers_url":"https://api.github.com/users/mintplugins/followers","following_url":"https://api.github.com/users/mintplugins/following{/other_user}","gists_url":"https://api.github.com/users/mintplugins/gists{/gist_id}","starred_url":"https://api.github.com/users/mintplugins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mintplugins/subscriptions","organizations_url":"https://api.github.com/users/mintplugins/orgs","repos_url":"https://api.github.com/users/mintplugins/repos","events_url":"https://api.github.com/users/mintplugins/events{/privacy}","received_events_url":"https://api.github.com/users/mintplugins/received_events","type":"User","site_admin":false},"created_at":"2016-11-07T23:01:42Z","updated_at":"2016-11-07T23:01:42Z","body":"PR: https://github.com/easydigitaldownloads/easy-digital-downloads/pull/5170"}}
{"actor":{"display_login":"mintplugins"}}