Skip to content

Commit 293faa9

Browse files
author
Willy
committed
API-410: Add doc for php client about creating family variant
1 parent 474e1af commit 293faa9

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

content/php-client/resources/family-variants.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,29 @@ $client = new \Akeneo\Pim\AkeneoPimClientBuilder('http://akeneo.com/')->buildAut
3030
*/
3131
$familyVariant = $client->getFamilyVariantApi()->get('boots', 'boots_color_size');
3232
```
33+
34+
### Create a family variant
35+
36+
If the family variant does not exist yet, this method creates it, otherwise it throws an exception.
37+
38+
```php
39+
$client = new \Akeneo\Pim\AkeneoPimClientBuilder('http://akeneo.com/')->buildAuthenticatedByPassword('client_id', 'secret', 'admin', 'admin');
40+
41+
$client->getFamilyVariantApi()->create('boots', 'boots_size_color', [
42+
'labels' => [
43+
'en_US' => 'Boots by color and size'
44+
],
45+
'variant_attribute_sets' => [
46+
[
47+
'level' => 1,
48+
'axes' => ['size'],
49+
'attributes' => ['name', 'description', 'size']
50+
],
51+
[
52+
'level' => 2,
53+
'axes' => ['color'],
54+
'attributes' => ['sku', 'color']
55+
]
56+
]
57+
]);
58+
```

0 commit comments

Comments
 (0)