{"action":"opened","issue":{"url":"https://api.github.com/repos/woocommerce/woocommerce/issues/19962","repository_url":"https://api.github.com/repos/woocommerce/woocommerce","labels_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/19962/labels{/name}","comments_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/19962/comments","events_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/19962/events","html_url":"https://github.com/woocommerce/woocommerce/issues/19962","id":320064747,"number":19962,"title":"API: products/categories endpoint filter not working","user":{"login":"admench","id":672916,"avatar_url":"https://avatars2.githubusercontent.com/u/672916?v=4","gravatar_id":"","url":"https://api.github.com/users/admench","html_url":"https://github.com/admench","followers_url":"https://api.github.com/users/admench/followers","following_url":"https://api.github.com/users/admench/following{/other_user}","gists_url":"https://api.github.com/users/admench/gists{/gist_id}","starred_url":"https://api.github.com/users/admench/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/admench/subscriptions","organizations_url":"https://api.github.com/users/admench/orgs","repos_url":"https://api.github.com/users/admench/repos","events_url":"https://api.github.com/users/admench/events{/privacy}","received_events_url":"https://api.github.com/users/admench/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-03T20:17:22Z","updated_at":"2018-05-03T20:17:22Z","closed_at":null,"author_association":"NONE","body":"\r\n\r\n## Prerequisites\r\n\r\n- [x] I have searched for similar issues in both open and closed tickets and cannot find a duplicate\r\n- [x] The issue still exists against the latest `master` branch of WooCommerce on Github (this is **not** the same version as on WordPress.org!)\r\n- [x] I have attempted to find the simplest possible steps to reproduce the issue\r\n- [ ] I have included a failing test as a pull request (Optional)\r\n\r\n## Steps to reproduce the issue\r\n\r\n<!-- We need to be able to reproduce the bug in order to fix it so please be descriptive! -->\r\n\r\n1. Create a new filter in functions.php for `woocommerce_rest_prepare_product_cat`\r\n2. Hit the `products/categories` API endpoint\r\n\r\n## Expected/actual behavior\r\n\r\nWhen I follow those steps, I do not get an appended property to the `products/categories` api response:\r\n\r\n```\r\nfunction prepare_category_images($response, $item, $request)\r\n{\r\n   \r\n    if (empty($response->data)) {\r\n        return $response;\r\n    }\r\n    $response->hello = 'world';\r\n    return $response;\r\n}\r\nadd_filter(\"woocommerce_rest_prepare_product_cat\", \"prepare_category_images\", 10, 3);\r\n```\r\n\r\nWhich simply results in the standard categories API response:\r\n\r\n```\r\n    7 => {#349 ▼\r\n      +\"id\": 60\r\n      +\"name\": \"Hooks &amp; Hangers\"\r\n      +\"slug\": \"hooks-hangers\"\r\n      +\"parent\": 0\r\n      +\"description\": \"\"\r\n      +\"display\": \"default\"\r\n      +\"image\": {#350 ▶}\r\n      +\"menu_order\": 7\r\n      +\"count\": 27\r\n      +\"_links\": {#352 ▶}\r\n    }\r\n```\r\n\r\nI was expecting to see...\r\n\r\n```\r\n    7 => {#349 ▼\r\n      +\"id\": 60\r\n      +\"name\": \"Hooks &amp; Hangers\"\r\n      +\"slug\": \"hooks-hangers\"\r\n      +\"parent\": 0\r\n      +\"description\": \"\"\r\n      +\"display\": \"default\"\r\n      +\"image\": {#350 ▶}\r\n      +\"menu_order\": 7\r\n      +\"count\": 27\r\n      +\"hello\": \"world\"\r\n      +\"_links\": {#352 ▶}\r\n    }\r\n```\r\n\r\n## Isolating the problem\r\n\r\n<!-- MARK COMPLETED ITEMS WITH AN [x] -->\r\n\r\n- [x] This bug happens with only WooCommerce plugin active\r\n- [x] This bug happens with a default WordPress theme active, or [Storefront](https://woocommerce.com/storefront/)\r\n- [x] I can reproduce this bug consistently using the steps above\r\n\r\n## WordPress Environment\r\n\r\n<details>\r\n```\r\n`\r\n### WordPress Environment ###\r\n\r\nHome URL: http://wp.website.test\r\nSite URL: http://wp.website.test\r\nWC Version: 3.3.0\r\nLog Directory Writable: ✔\r\nWP Version: 4.9.5\r\nWP Multisite: –\r\nWP Memory Limit: 256 MB\r\nWP Debug Mode: ✔\r\nWP Cron: ✔\r\nLanguage: en_GB\r\nExternal object cache: –\r\n\r\n### Server Environment ###\r\n\r\nServer Info: nginx/1.12.2\r\nPHP Version: 7.1.12\r\nPHP Post Max Size: 128 MB\r\nPHP Time Limit: 60\r\nPHP Max Input Vars: 1000\r\ncURL Version: 7.54.0\r\nLibreSSL/2.0.20\r\n\r\nSUHOSIN Installed: –\r\nMySQL Version: 5.7.20\r\nMax Upload Size: 128 MB\r\nDefault Timezone is UTC: ✔\r\nfsockopen/cURL: ✔\r\nSoapClient: ✔\r\nDOMDocument: ✔\r\nGZip: ✔\r\nMultibyte String: ✔\r\nRemote Post: ✔\r\nRemote Get: ✔\r\n\r\n### Database ###\r\n\r\nWC Database Version: 3.3.0\r\nWC Database Prefix: wp_\r\nTotal Database Size: 49.23MB\r\nDatabase Data Size: 29.02MB\r\nDatabase Index Size: 20.21MB\r\nwp_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB\r\nwp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB\r\nwp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB\r\nwp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.05MB\r\nwp_woocommerce_order_items: Data: 0.30MB + Index: 0.11MB\r\nwp_woocommerce_order_itemmeta: Data: 2.52MB + Index: 3.03MB\r\nwp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB\r\nwp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.05MB\r\nwp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB\r\nwp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.05MB\r\nwp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB\r\nwp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB\r\nwp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB\r\nwp_woocommerce_log: Data: 0.02MB + Index: 0.02MB\r\nwp_commentmeta: Data: 0.02MB + Index: 0.03MB\r\nwp_comments: Data: 2.52MB + Index: 1.23MB\r\nwp_links: Data: 0.02MB + Index: 0.02MB\r\nwp_options: Data: 7.47MB + Index: 2.47MB\r\nwp_postmeta: Data: 11.52MB + Index: 11.03MB\r\nwp_posts: Data: 3.52MB + Index: 1.20MB\r\nwp_rac_abandoncart: Data: 0.08MB + Index: 0.00MB\r\nwp_rac_email_logs: Data: 0.02MB + Index: 0.00MB\r\nwp_rac_templates_email: Data: 0.02MB + Index: 0.00MB\r\nwp_termmeta: Data: 0.06MB + Index: 0.03MB\r\nwp_terms: Data: 0.05MB + Index: 0.03MB\r\nwp_term_relationships: Data: 0.34MB + Index: 0.30MB\r\nwp_term_taxonomy: Data: 0.06MB + Index: 0.03MB\r\nwp_usermeta: Data: 0.14MB + Index: 0.14MB\r\nwp_users: Data: 0.02MB + Index: 0.05MB\r\nwp_wc_download_log: Data: 0.02MB + Index: 0.03MB\r\nwp_wc_webhooks: Data: 0.02MB + Index: 0.02MB\r\nwp_woocommerce_termmeta: Data: 0.02MB + Index: 0.03MB\r\nwp_yith_wcwl: Data: 0.02MB + Index: 0.05MB\r\nwp_yith_wcwl_lists: Data: 0.02MB + Index: 0.03MB\r\n\r\n### Post Type Counts ###\r\n\r\nacf-field: 1\r\nacf-field-group: 1\r\nattachment: 2938\r\ncustomize_changeset: 1\r\nmc4wp-form: 1\r\nml-slider: 1\r\nnav_menu_item: 19\r\npage: 25\r\npost: 9\r\nproduct: 772\r\nproduct_variation: 341\r\nrevision: 82\r\nshop_coupon: 11\r\nshop_order: 2216\r\nshop_order_refund: 8\r\nsidebar: 1\r\n\r\n### Security ###\r\n\r\nSecure connection (HTTPS): ❌Your store is not using HTTPS. Learn more about HTTPS and SSL Certificates.\r\nHide errors from visitors: ❌Error messages should not be shown to visitors.\r\n\r\n### Active Plugins (5) ###\r\n\r\nAdvanced Custom Fields PRO: by Elliot Condon – 5.6.10\r\nRegenerate Thumbnails: by Alex Mills (Viper007Bond) – 3.0.2\r\nWooCommerce POS: by kilbot – 0.4.18\r\nWooCommerce Shipping Pro: by WooForce – 2.1.1 – Not tested with the active version of WooCommerce\r\nWooCommerce: by Automattic – 3.4.0-dev\r\n\r\n### Settings ###\r\n\r\nAPI Enabled: –\r\nForce SSL: –\r\nCurrency: GBP (£)\r\nCurrency Position: left\r\nThousand Separator: ,\r\nDecimal Separator: .\r\nNumber of Decimals: 2\r\nTaxonomies: Product Types: external (external)\r\ngrouped (grouped)\r\nsimple (simple)\r\nvariable (variable)\r\n\r\nTaxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)\r\nexclude-from-search (exclude-from-search)\r\nfeatured (featured)\r\noutofstock (outofstock)\r\nrated-1 (rated-1)\r\nrated-2 (rated-2)\r\nrated-3 (rated-3)\r\nrated-4 (rated-4)\r\nrated-5 (rated-5)\r\n\r\n\r\n### WC Pages ###\r\n\r\nShop base: #4 - /shop/\r\nCart: #5 - /my-account/cart/\r\nCheckout: #6 - /my-account/checkout/\r\nMy account: #7 - /my-account/\r\nTerms and conditions: #254 - /information/terms-conditions/\r\n\r\n### Theme ###\r\n\r\nName: Mench Living\r\nVersion: 1.0\r\nAuthor URL: https://youi.design\r\nChild Theme: ✔\r\nParent Theme Name: Storefront\r\nParent Theme Version: 2.2.8\r\nParent Theme Author URL: https://woocommerce.com/\r\nWooCommerce Support: ✔\r\n\r\n### Templates ###\r\n\r\nOverrides: –\r\n`\r\n```\r\n</details>\r\n"}}
{"actor":{"display_login":"admench"}}