true` in WooCommerce's product schema (v2 and v3), so * WooCommerce ignores it on write and no child can be removed by omission. Anything that changes * this class must re-verify that property. */ final class Variable_Children { /** * Narrow `variations[]` on a serialized variable product. * * Non-variable products and payloads without a usable list pass through untouched. The `type` * gate comes first so a page of simple products never pays for a lookup. * * @param mixed $payload Serialized product record. * @param null|mixed $object Product object, when the lane has one loaded. * @param null|mixed $request Request context. */ public static function augment_record( $payload, $object = null, $request = null ) { if ( ! \is_array( $payload ) || 'variable' !== ( $payload['type'] ?? '' ) ) { return $payload; } if ( ! isset( $payload['variations'] ) || ! \is_array( $payload['variations'] ) ) { return $payload; } $children = array_values( array_filter( array_map( 'intval', $payload['variations'] ) ) ); if ( array() === $children ) { return $payload; } $payload['variations'] = array_values( array_filter( ( new Pos_Visibility() )->filter_visible_children( $children ), static function ( int $id ): bool { return 'publish' === get_post_status( $id ); } ) ); return $payload; } }