@@ -70,69 +70,69 @@ $data = [
7070
7171// For Variable Product
7272$data = [
73- 'name' => 'Variable Product', // Product Name pr Title
74- 'type' => 'variable', // Product Type simple|variable
75- 'description' => 'Product Description', // Product Long Description
76- 'short_description' => 'Product Summery', // Product Short Description
77- // Product Categories
78- 'categories' => [
79- [
80- 'id' => 9,
81- ],
82- [
83- 'id' => 14,
84- ],
85- ],
86- // Product images
87- 'images' => [
88- [
89- 'src' => 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_4_front.jpg',
90- ],
91- [
92- 'src' => 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_4_back.jpg',
93- ],
94- [
95- 'src' => 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_3_front.jpg',
96- ],
97- [
98- 'src' => 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_3_back.jpg',
99- ],
100- ],
101- // Product Attributes
102- 'attributes' => [
103- [
104- 'id' => 6,
105- 'position' => 0,
106- 'visible' => false,
107- 'variation' => true,
108- 'options' => [
109- 'Black',
110- 'Green',
111- ],
112- ],
113- [
114- 'name' => 'Size',
115- 'position' => 0,
116- 'visible' => true,
117- 'variation' => true,
118- 'options' => [
119- 'S',
120- 'M',
121- ],
122- ],
73+ 'name' => 'Variable Product', // Product Name pr Title
74+ 'type' => 'variable', // Product Type simple|variable
75+ 'description' => 'Product Description', // Product Long Description
76+ 'short_description' => 'Product Summery', // Product Short Description
77+ // Product Categories
78+ 'categories' => [
79+ [
80+ 'id' => 9,
81+ ],
82+ [
83+ 'id' => 14,
84+ ],
85+ ],
86+ // Product images
87+ 'images' => [
88+ [
89+ 'src' => 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_4_front.jpg',
90+ ],
91+ [
92+ 'src' => 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_4_back.jpg',
93+ ],
94+ [
95+ 'src' => 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_3_front.jpg',
96+ ],
97+ [
98+ 'src' => 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_3_back.jpg',
99+ ],
100+ ],
101+ // Product Attributes
102+ 'attributes' => [
103+ [
104+ 'id' => 6,
105+ 'position' => 0,
106+ 'visible' => false,
107+ 'variation' => true,
108+ 'options' => [
109+ 'Black',
110+ 'Green',
123111 ],
124- // Set Default attributes
125- 'default_attributes' => [
126- [
127- 'id' => 6,
128- 'option' => 'Black',
129- ],
130- [
131- 'name' => 'Size',
132- 'option' => 'S',
133- ],
112+ ],
113+ [
114+ 'name' => 'Size',
115+ 'position' => 0,
116+ 'visible' => true,
117+ 'variation' => true,
118+ 'options' => [
119+ 'S',
120+ 'M',
134121 ],
135- ];
122+ ],
123+ ],
124+ // Set Default attributes
125+ 'default_attributes' => [
126+ [
127+ 'id' => 6,
128+ 'option' => 'Black',
129+ ],
130+ [
131+ 'name' => 'Size',
132+ 'option' => 'S',
133+ ],
134+ ],
135+ ];
136136
137137// Create a product using create() method
138138$product = Product::create($data);
0 commit comments