{"action":"created","issue":{"url":"https://api.github.com/repos/woocommerce/woocommerce/issues/12666","repository_url":"https://api.github.com/repos/woocommerce/woocommerce","labels_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/12666/labels{/name}","comments_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/12666/comments","events_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/12666/events","html_url":"https://github.com/woocommerce/woocommerce/pull/12666","id":196946550,"number":12666,"title":"Upgrade Select2 to V4","user":{"login":"mikejolley","id":90977,"avatar_url":"https://avatars.githubusercontent.com/u/90977?v=3","gravatar_id":"","url":"https://api.github.com/users/mikejolley","html_url":"https://github.com/mikejolley","followers_url":"https://api.github.com/users/mikejolley/followers","following_url":"https://api.github.com/users/mikejolley/following{/other_user}","gists_url":"https://api.github.com/users/mikejolley/gists{/gist_id}","starred_url":"https://api.github.com/users/mikejolley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikejolley/subscriptions","organizations_url":"https://api.github.com/users/mikejolley/orgs","repos_url":"https://api.github.com/users/mikejolley/repos","events_url":"https://api.github.com/users/mikejolley/events{/privacy}","received_events_url":"https://api.github.com/users/mikejolley/received_events","type":"User","site_admin":false},"labels":[{"id":33006752,"url":"https://api.github.com/repos/woocommerce/woocommerce/labels/[!]%20Needs%20Review%20/%20Feedback","name":"[!] Needs Review / Feedback","color":"a46497","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/woocommerce/woocommerce/milestones/53","html_url":"https://github.com/woocommerce/woocommerce/milestone/53","labels_url":"https://api.github.com/repos/woocommerce/woocommerce/milestones/53/labels","id":1537224,"number":53,"title":"2.7","description":"2.7 will focus on API + CRUD improvements.","creator":{"login":"mikejolley","id":90977,"avatar_url":"https://avatars.githubusercontent.com/u/90977?v=3","gravatar_id":"","url":"https://api.github.com/users/mikejolley","html_url":"https://github.com/mikejolley","followers_url":"https://api.github.com/users/mikejolley/followers","following_url":"https://api.github.com/users/mikejolley/following{/other_user}","gists_url":"https://api.github.com/users/mikejolley/gists{/gist_id}","starred_url":"https://api.github.com/users/mikejolley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikejolley/subscriptions","organizations_url":"https://api.github.com/users/mikejolley/orgs","repos_url":"https://api.github.com/users/mikejolley/repos","events_url":"https://api.github.com/users/mikejolley/events{/privacy}","received_events_url":"https://api.github.com/users/mikejolley/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":240,"state":"open","created_at":"2016-01-22T23:35:12Z","updated_at":"2016-12-21T14:33:20Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2016-12-21T14:31:35Z","updated_at":"2016-12-21T18:03:03Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/woocommerce/woocommerce/pulls/12666","html_url":"https://github.com/woocommerce/woocommerce/pull/12666","diff_url":"https://github.com/woocommerce/woocommerce/pull/12666.diff","patch_url":"https://github.com/woocommerce/woocommerce/pull/12666.patch"},"body":"This upgrades the script and code using Select2.\r\n\r\nThis fixes #12622.\r\n\r\n@franticpsyx @roykho @gedex @helgatheviking @thenbrent This may concern you. Some of the markup has changed to support this update. Upgrade instructions below.\r\n\r\nThoughts on this for 2.7? Difficult change I know -.-\r\n\r\n---\r\n\r\n# Migrating to Select2 V4\r\n\r\nSelect2 V4 is mostly compatible with Select2 V3 [with a few exceptions](https://select2.github.io/options.html#backwards-compatibility), the main one being how AJAX search inputs work. WooCommerce has two instances of these which are affected and need some HTML markup changes to function. \r\n\r\n## wc-product-search inputs\r\n\r\nThese inputs were 'hidden' text inputs in v3. In v4 these needs to be changed to regular multiselect elements.\r\n\r\nExample:\r\n\r\n```\r\n<input type=\"hidden\" id=\"grant_access_id\" name=\"grant_access_id\" data-multiple=\"true\" class=\"wc-product-search\" style=\"width: 400px;\" data-placeholder=\"<?php esc_attr_e( 'Search for a downloadable product&hellip;', 'woocommerce' ); ?>\" data-action=\"woocommerce_json_search_downloadable_products_and_variations\" />\r\n```\r\n\r\nWould be changed to a regular multiselect field:\r\n\r\n```\r\n<select id=\"grant_access_id\" class=\"wc-product-search\" name=\"grant_access_id[]\" multiple=\"multiple\" style=\"width: 400px;\" data-placeholder=\"<?php esc_attr_e( 'Search for a downloadable product&hellip;', 'woocommerce' ); ?>\" data-action=\"woocommerce_json_search_downloadable_products_and_variations\"></select>\r\n```\r\n\r\n__Field name__\r\n\r\nNote that the field name in this case was changed from `grant_access_id` to `grant_access_id[]`.\r\n\r\n__Multiple attribute__\r\n\r\n`data-multiple` is no longer needed. The `multiple` prop is added instead. This supports multiple selections.\r\n\r\n__Handling the POSTed data__\r\n\r\nIn the previous example, the hidden input would have posted a comma delimited string of IDs. With the switch to multi selects, this code needs to handle an *array of values* instead.\r\n\r\n## wc-customer-search inputs\r\n\r\nHandled in the same way as `wc-product-search`."},"comment":{"url":"https://api.github.com/repos/woocommerce/woocommerce/issues/comments/268596017","html_url":"https://github.com/woocommerce/woocommerce/pull/12666#issuecomment-268596017","issue_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/12666","id":268596017,"user":{"login":"helgatheviking","id":507025,"avatar_url":"https://avatars.githubusercontent.com/u/507025?v=3","gravatar_id":"","url":"https://api.github.com/users/helgatheviking","html_url":"https://github.com/helgatheviking","followers_url":"https://api.github.com/users/helgatheviking/followers","following_url":"https://api.github.com/users/helgatheviking/following{/other_user}","gists_url":"https://api.github.com/users/helgatheviking/gists{/gist_id}","starred_url":"https://api.github.com/users/helgatheviking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/helgatheviking/subscriptions","organizations_url":"https://api.github.com/users/helgatheviking/orgs","repos_url":"https://api.github.com/users/helgatheviking/repos","events_url":"https://api.github.com/users/helgatheviking/events{/privacy}","received_events_url":"https://api.github.com/users/helgatheviking/received_events","type":"User","site_admin":false},"created_at":"2016-12-21T18:03:03Z","updated_at":"2016-12-21T18:03:03Z","body":"Will this be able to support drag/drop re-ordering? I know that was something v2 was able to handle, but the multiselect markup makes more difficult. "}}
{"actor":{"display_login":"helgatheviking"}}