{"action":"created","issue":{"url":"https://api.github.com/repos/woocommerce/woocommerce/issues/15480","repository_url":"https://api.github.com/repos/woocommerce/woocommerce","labels_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/15480/labels{/name}","comments_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/15480/comments","events_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/15480/events","html_url":"https://github.com/woocommerce/woocommerce/issues/15480","id":233967186,"number":15480,"title":"API: Blank variations for global attributes","user":{"login":"smith-daniels","id":22600283,"avatar_url":"https://avatars2.githubusercontent.com/u/22600283?v=3","gravatar_id":"","url":"https://api.github.com/users/smith-daniels","html_url":"https://github.com/smith-daniels","followers_url":"https://api.github.com/users/smith-daniels/followers","following_url":"https://api.github.com/users/smith-daniels/following{/other_user}","gists_url":"https://api.github.com/users/smith-daniels/gists{/gist_id}","starred_url":"https://api.github.com/users/smith-daniels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smith-daniels/subscriptions","organizations_url":"https://api.github.com/users/smith-daniels/orgs","repos_url":"https://api.github.com/users/smith-daniels/repos","events_url":"https://api.github.com/users/smith-daniels/events{/privacy}","received_events_url":"https://api.github.com/users/smith-daniels/received_events","type":"User","site_admin":false},"labels":[{"id":33006826,"url":"https://api.github.com/repos/woocommerce/woocommerce/labels/Focus:%20API","name":"Focus: API","color":"fef2c0","default":false},{"id":152990,"url":"https://api.github.com/repos/woocommerce/woocommerce/labels/Type:%20Bug","name":"Type: Bug","color":"F21B3F","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/woocommerce/woocommerce/milestones/82","html_url":"https://github.com/woocommerce/woocommerce/milestone/82","labels_url":"https://api.github.com/repos/woocommerce/woocommerce/milestones/82/labels","id":2558732,"number":82,"title":"⚡ 3.1.0 - Sprint 7","description":"","creator":{"login":"mikejolley","id":90977,"avatar_url":"https://avatars1.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":1,"closed_issues":15,"state":"open","created_at":"2017-06-02T16:18:53Z","updated_at":"2017-06-07T12:02:27Z","due_on":"2017-06-11T07:00:00Z","closed_at":null},"comments":2,"created_at":"2017-06-06T17:29:30Z","updated_at":"2017-06-07T12:54:07Z","closed_at":"2017-06-07T10:26:32Z","body":"### EXPLANATION OF THE ISSUE\r\n\r\nThe bug here seems similar to this issue, except the variation does not work outside the admin view either. https://github.com/woocommerce/woocommerce/issues/11200 \r\n\r\nCreation of a product variation via the API with a global attribute creates an empty variation instead of the specified variation.\r\n\r\nWooCommerce version 3.0.7\r\n\r\n### STEPS TO REPRODUCE THE ISSUE\r\n\r\n1. Create a product via the API with a global attribute\r\n\r\n*Note the sent attribute information refers to a global attribute already created via the UI\r\n\r\nEndpoint: /wp-json/wc/v2/products\r\n\r\n```json\r\n{\r\n        \"name\": \"Premium Quality 8.0\",\r\n        \"type\": \"variable\",\r\n        \"regular_price\": \"21.99\",\r\n        \"description\": \"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.\",\r\n        \"short_description\": \"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.\",\r\n        \"categories\": [\r\n                {\r\n                        \"id\": 9\r\n                },\r\n                {\r\n                        \"id\": 14\r\n                }\r\n        ],\r\n        \"images\": [\r\n                {\r\n                        \"src\": \"http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_2_front.jpg\",\r\n                        \"position\": 0\r\n                },\r\n                {\r\n                        \"src\": \"http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_2_back.jpg\",\r\n                        \"position\": 1\r\n                }\r\n        ],\r\n        \"attributes\": [\r\n                {\r\n                        \"id\": 1,\r\n                        \"name\": \"Rate\",\r\n                        \"slug\": \"rate\",\r\n                        \"visible\": true,\r\n                        \"variation\": true,\r\n                        \"options\": [\r\n                                \"day\",\r\n                                \"4 hours\",\r\n                                \"week\"\r\n                        ]\r\n                }\r\n        ]\r\n}\r\n```\r\n\r\nJSON Response\r\n\r\n```json\r\n{\r\n  \"id\": 163,\r\n  \"name\": \"Premium Quality 8.0\",\r\n  \"slug\": \"premium-quality-8-0-2\",\r\n  \"permalink\": \"http://example.com/wordpress/product/premium-quality-8-0-2/\",\r\n  \"date_created\": \"2017-06-06T15:40:04\",\r\n  \"date_created_gmt\": \"2017-06-06T15:40:04\",\r\n  \"date_modified\": \"2017-06-06T15:40:04\",\r\n  \"date_modified_gmt\": \"2017-06-06T15:40:04\",\r\n  \"type\": \"variable\",\r\n  \"status\": \"publish\",\r\n  \"featured\": false,\r\n  \"catalog_visibility\": \"visible\",\r\n  \"description\": \"<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>\\n\",\r\n  \"short_description\": \"<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>\\n\",\r\n  \"sku\": \"\",\r\n  \"price\": \"\",\r\n  \"regular_price\": \"\",\r\n  \"sale_price\": \"\",\r\n  \"date_on_sale_from\": null,\r\n  \"date_on_sale_from_gmt\": null,\r\n  \"date_on_sale_to\": null,\r\n  \"date_on_sale_to_gmt\": null,\r\n  \"price_html\": \"\",\r\n  \"on_sale\": false,\r\n  \"purchasable\": false,\r\n  \"total_sales\": 0,\r\n  \"virtual\": false,\r\n  \"downloadable\": false,\r\n  \"downloads\": [],\r\n  \"download_limit\": -1,\r\n  \"download_expiry\": -1,\r\n  \"external_url\": \"\",\r\n  \"button_text\": \"\",\r\n  \"tax_status\": \"taxable\",\r\n  \"tax_class\": \"\",\r\n  \"manage_stock\": false,\r\n  \"stock_quantity\": null,\r\n  \"in_stock\": false,\r\n  \"backorders\": \"no\",\r\n  \"backorders_allowed\": false,\r\n  \"backordered\": false,\r\n  \"sold_individually\": false,\r\n  \"weight\": \"\",\r\n  \"dimensions\": {\r\n    \"length\": \"\",\r\n    \"width\": \"\",\r\n    \"height\": \"\"\r\n  },\r\n  \"shipping_required\": true,\r\n  \"shipping_taxable\": true,\r\n  \"shipping_class\": \"\",\r\n  \"shipping_class_id\": 0,\r\n  \"reviews_allowed\": true,\r\n  \"average_rating\": \"0.00\",\r\n  \"rating_count\": 0,\r\n  \"related_ids\": [],\r\n  \"upsell_ids\": [],\r\n  \"cross_sell_ids\": [],\r\n  \"parent_id\": 0,\r\n  \"purchase_note\": \"\",\r\n  \"categories\": [],\r\n  \"tags\": [],\r\n  \"images\": [\r\n    {\r\n      \"id\": 161,\r\n      \"date_created\": \"2017-06-06T15:39:59\",\r\n      \"date_created_gmt\": \"2017-06-06T15:39:59\",\r\n      \"date_modified\": \"2017-06-06T15:39:59\",\r\n      \"date_modified_gmt\": \"2017-06-06T15:39:59\",\r\n      \"src\": \"http://example.com/wordpress/wp-content/uploads/2017/06/T_2_front-8.jpg\",\r\n      \"name\": \"\",\r\n      \"alt\": \"\",\r\n      \"position\": 0\r\n    },\r\n    {\r\n      \"id\": 162,\r\n      \"date_created\": \"2017-06-06T15:40:02\",\r\n      \"date_created_gmt\": \"2017-06-06T15:40:02\",\r\n      \"date_modified\": \"2017-06-06T15:40:02\",\r\n      \"date_modified_gmt\": \"2017-06-06T15:40:02\",\r\n      \"src\": \"http://example.com/wordpress/wp-content/uploads/2017/06/T_2_back-8.jpg\",\r\n      \"name\": \"\",\r\n      \"alt\": \"\",\r\n      \"position\": 1\r\n    }\r\n  ],\r\n  \"attributes\": [\r\n    {\r\n      \"id\": 1,\r\n      \"name\": \"Rate\",\r\n      \"position\": 0,\r\n      \"visible\": true,\r\n      \"variation\": true,\r\n      \"options\": [\r\n        \"4 Hours\",\r\n        \"Day\",\r\n        \"Week\"\r\n      ]\r\n    }\r\n  ],\r\n  \"default_attributes\": [],\r\n  \"variations\": [],\r\n  \"grouped_products\": [],\r\n  \"menu_order\": 0,\r\n  \"meta_data\": [],\r\n  \"_links\": {\r\n    \"self\": [\r\n      {\r\n        \"href\": \"http://example.com/wordpress/wp-json/wc/v2/products/163\"\r\n      }\r\n    ],\r\n    \"collection\": [\r\n      {\r\n        \"href\": \"http://example.com/wordpress/wp-json/wc/v2/products\"\r\n      }\r\n    ]\r\n  }\r\n}\r\n```\r\n2. Create a product variation for that product\r\n\r\nEndpoint: /wp-json/wc/v2/products/163/variations\r\n\r\n```json\r\n{\r\n  \"regular_price\": \"9.00\",\r\n  \"image\": {\r\n    \"id\": 119\r\n  },\r\n  \"attributes\": [\r\n    {\r\n      \"id\": 1,\r\n      \"option\": \"Day\"\r\n    }\r\n  ]\r\n}\r\n```\r\n\r\nJSON Response\r\n\r\n```json\r\n{\r\n  \"id\": 164,\r\n  \"date_created\": \"2017-06-06T15:41:15\",\r\n  \"date_created_gmt\": \"2017-06-06T15:41:15\",\r\n  \"date_modified\": \"2017-06-06T15:41:15\",\r\n  \"date_modified_gmt\": \"2017-06-06T15:41:15\",\r\n  \"description\": \"\",\r\n  \"permalink\": \"http://example.com/wordpress/product/premium-quality-8-0-2/\",\r\n  \"sku\": \"\",\r\n  \"price\": \"\",\r\n  \"regular_price\": \"\",\r\n  \"sale_price\": \"\",\r\n  \"date_on_sale_from\": null,\r\n  \"date_on_sale_from_gmt\": null,\r\n  \"date_on_sale_to\": null,\r\n  \"date_on_sale_to_gmt\": null,\r\n  \"on_sale\": false,\r\n  \"visible\": true,\r\n  \"purchasable\": false,\r\n  \"virtual\": false,\r\n  \"downloadable\": false,\r\n  \"downloads\": [],\r\n  \"download_limit\": -1,\r\n  \"download_expiry\": -1,\r\n  \"tax_status\": \"taxable\",\r\n  \"tax_class\": \"\",\r\n  \"manage_stock\": false,\r\n  \"stock_quantity\": null,\r\n  \"in_stock\": true,\r\n  \"backorders\": \"no\",\r\n  \"backorders_allowed\": false,\r\n  \"backordered\": false,\r\n  \"weight\": \"\",\r\n  \"dimensions\": {\r\n    \"length\": \"\",\r\n    \"width\": \"\",\r\n    \"height\": \"\"\r\n  },\r\n  \"shipping_class\": \"\",\r\n  \"shipping_class_id\": 0,\r\n  \"image\": {\r\n    \"id\": 0,\r\n    \"date_created\": \"2017-06-06T15:41:15\",\r\n    \"date_created_gmt\": \"2017-06-06T15:41:15\",\r\n    \"date_modified\": \"2017-06-06T15:41:15\",\r\n    \"date_modified_gmt\": \"2017-06-06T15:41:15\",\r\n    \"src\": \"http://example.com/wordpress/wp-content/plugins/woocommerce/assets/images/placeholder.png\",\r\n    \"name\": \"Placeholder\",\r\n    \"alt\": \"Placeholder\",\r\n    \"position\": 0\r\n  },\r\n  \"attributes\": [],\r\n  \"menu_order\": 0,\r\n  \"meta_data\": [],\r\n  \"_links\": {\r\n    \"self\": [\r\n      {\r\n        \"href\": \"http://example.com/wordpress/wp-json/wc/v2/products/163/variations/164\"\r\n      }\r\n    ],\r\n    \"collection\": [\r\n      {\r\n        \"href\": \"http://example.com/wordpress/wp-json/wc/v2/products/163/variations\"\r\n      }\r\n    ],\r\n    \"up\": [\r\n      {\r\n        \"href\": \"http://example.com/wordpress/wp-json/wc/v2/products/163\"\r\n      }\r\n    ]\r\n  }\r\n}\r\n```\r\n![variation-photo-1](https://user-images.githubusercontent.com/22600283/26842780-fa7ffc30-4abb-11e7-9863-8886dd33d4e6.png)\r\n![variation-photo-2](https://user-images.githubusercontent.com/22600283/26842782-fa84a258-4abb-11e7-80af-946db7ff6ee9.png)\r\n![variation-photo-3](https://user-images.githubusercontent.com/22600283/26842781-fa83f5b0-4abb-11e7-964f-e02fce73030a.png)\r\n![variation-photo-4](https://user-images.githubusercontent.com/22600283/26842784-fa87170e-4abb-11e7-9b0d-027408341701.png)\r\n![variation-photo-5](https://user-images.githubusercontent.com/22600283/26842783-fa846edc-4abb-11e7-9225-1f4ab5c73014.png)\r\n\r\n[Additional video of bug](https://www.dropbox.com/s/ueo0qlqpvhlghbd/Sequence%2002.mp4?dl=0)\r\n\r\n\r\n\r\n### SYSTEM STATUS\r\n\r\n<details>\r\n```\r\n### WordPress Environment ###\r\n\r\nHome URL: http://example.com/wordpress\r\nSite URL: http://example.com/wordpress\r\nWC Version: 3.0.7\r\nLog Directory Writable: ✔\r\nWP Version: 4.7.5\r\nWP Multisite: –\r\nWP Memory Limit: 256 MB\r\nWP Debug Mode: –\r\nWP Cron: ✔\r\nLanguage: en_US\r\n\r\n### Server Environment ###\r\n\r\nServer Info: Apache\r\nPHP Version: 5.6.29\r\nPHP Post Max Size: 64 MB\r\nPHP Time Limit: 30\r\nPHP Max Input Vars: 1000\r\ncURL Version: 7.24.0\r\nOpenSSL/1.0.0\r\n\r\nSUHOSIN Installed: –\r\nMySQL Version: 5.6.32\r\nMax Upload Size: 64 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.0.7\r\nWC Database Prefix: wp_\r\nwoocommerce_sessions: ✔\r\nwoocommerce_api_keys: ✔\r\nwoocommerce_attribute_taxonomies: ✔\r\nwoocommerce_downloadable_product_permissions: ✔\r\nwoocommerce_order_items: ✔\r\nwoocommerce_order_itemmeta: ✔\r\nwoocommerce_tax_rates: ✔\r\nwoocommerce_tax_rate_locations: ✔\r\nwoocommerce_shipping_zones: ✔\r\nwoocommerce_shipping_zone_locations: ✔\r\nwoocommerce_shipping_zone_methods: ✔\r\nwoocommerce_payment_tokens: ✔\r\nwoocommerce_payment_tokenmeta: ✔\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: ✔\r\n\r\n### Active Plugins (2) ###\r\n\r\nRegenerate Thumbnails: by Alex Mills (Viper007Bond) – 2.2.6\r\nWooCommerce: by Automattic – 3.0.7\r\n\r\n### Settings ###\r\n\r\nAPI Enabled: ✔\r\nForce SSL: –\r\nCurrency: USD ($)\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: #45 - /shop/\r\nCart: #46 - /cart/\r\nCheckout: #47 - /checkout/\r\nMy account: #48 - /my-account/\r\n\r\n### Theme ###\r\n\r\nName: Gardener\r\nVersion: 0.0.12\r\nAuthor URL: http://mythem.es/\r\nChild Theme: ✔\r\nParent Theme Name: Tempo\r\nParent Theme Version: 0.0.39\r\nParent Theme Author URL: http://mythem.es/\r\nWooCommerce Support: ❌ Not declared\r\n\r\n### Templates ###\r\n\r\nOverrides: –\r\n```\r\n</details>\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/woocommerce/woocommerce/issues/comments/306785619","html_url":"https://github.com/woocommerce/woocommerce/issues/15480#issuecomment-306785619","issue_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/15480","id":306785619,"user":{"login":"smith-daniels","id":22600283,"avatar_url":"https://avatars2.githubusercontent.com/u/22600283?v=3","gravatar_id":"","url":"https://api.github.com/users/smith-daniels","html_url":"https://github.com/smith-daniels","followers_url":"https://api.github.com/users/smith-daniels/followers","following_url":"https://api.github.com/users/smith-daniels/following{/other_user}","gists_url":"https://api.github.com/users/smith-daniels/gists{/gist_id}","starred_url":"https://api.github.com/users/smith-daniels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smith-daniels/subscriptions","organizations_url":"https://api.github.com/users/smith-daniels/orgs","repos_url":"https://api.github.com/users/smith-daniels/repos","events_url":"https://api.github.com/users/smith-daniels/events{/privacy}","received_events_url":"https://api.github.com/users/smith-daniels/received_events","type":"User","site_admin":false},"created_at":"2017-06-07T12:54:07Z","updated_at":"2017-06-07T12:54:07Z","body":"Just another thought, what type of attribute did you use, text or select. I failed to mention that in my post which could be a difference between our setups given that I cannot see what type of attribute you setup."}}
{"actor":{"display_login":"smith-daniels"}}