@@ -114,24 +114,26 @@ 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 ;
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
+ }
127
+ // Assign parent product name to all child products' name (used as variant name is Meta catalog)
128
+ // https://developers.facebook.com/docs/commerce-platform/catalog/variants
129
+ $ childProduct ->setName ($ product ->getName ());
130
+ $ childProduct ->setConfigurableSettings ($ configurableSettings );
131
+ $ childProduct ->setParentProductUrl ($ product ->getProductUrl ());
132
+ if (!$ childProduct ->getDescription ()) {
133
+ $ childProduct ->setDescription ($ product ->getDescription ());
134
+ }
135
+ $ simpleProducts [] = $ childProduct ;
125
136
}
126
- // Assign parent product name to all child products' name (used as variant name is Meta catalog)
127
- // https://developers.facebook.com/docs/commerce-platform/catalog/variants
128
- $ childProduct ->setName ($ product ->getName ());
129
- $ childProduct ->setConfigurableSettings ($ configurableSettings );
130
- $ childProduct ->setParentProductUrl ($ product ->getProductUrl ());
131
- if (!$ childProduct ->getDescription ()) {
132
- $ childProduct ->setDescription ($ product ->getDescription ());
133
- }
134
- $ simpleProducts [] = $ childProduct ;
135
137
}
136
138
}
137
139
0 commit comments