@@ -114,15 +114,16 @@ public function retrieve($offset = 1, $limit = self::LIMIT): array
114
114
$ configurableAttributes = $ configurableType ->getConfigurableAttributes ($ product );
115
115
116
116
foreach ($ configurableType ->getUsedProducts ($ product ) as $ childProduct ) {
117
- /** @var Product $childProduct */
118
- $ configurableSettings = ['item_group_id ' => $ product ->getId ()];
119
- foreach ($ configurableAttributes as $ attribute ) {
120
- $ productAttribute = $ attribute ->getProductAttribute ();
121
- $ attributeCode = $ productAttribute ->getAttributeCode ();
122
- $ attributeValue = $ childProduct ->getData ($ productAttribute ->getAttributeCode ());
123
- $ attributeLabel = $ productAttribute ->getSource ()->getOptionText ($ attributeValue );
124
- $ configurableSettings [$ attributeCode ] = $ attributeLabel ;
125
- }
117
+ if ($ childProduct ->getStatus () == Status::STATUS_ENABLED ) {
118
+ /** @var Product $childProduct */
119
+ $ configurableSettings = ['item_group_id ' => $ product ->getId ()];
120
+ foreach ($ configurableAttributes as $ attribute ) {
121
+ $ productAttribute = $ attribute ->getProductAttribute ();
122
+ $ attributeCode = $ productAttribute ->getAttributeCode ();
123
+ $ attributeValue = $ childProduct ->getData ($ productAttribute ->getAttributeCode ());
124
+ $ attributeLabel = $ productAttribute ->getSource ()->getOptionText ($ attributeValue );
125
+ $ configurableSettings [$ attributeCode ] = $ attributeLabel ;
126
+ }
126
127
// Assign parent product name to all child products' name (used as variant name is Meta catalog)
127
128
// https://developers.facebook.com/docs/commerce-platform/catalog/variants
128
129
$ childProduct ->setName ($ product ->getName ());
@@ -132,6 +133,7 @@ public function retrieve($offset = 1, $limit = self::LIMIT): array
132
133
$ childProduct ->setDescription ($ product ->getDescription ());
133
134
}
134
135
$ simpleProducts [] = $ childProduct ;
136
+ }
135
137
}
136
138
}
137
139
0 commit comments