How do I set up this view? I'm using the https://www.drupal.org/project/views_field_view module on my Drupal 8 installation, and my current setup consists of:


Products (Content Type - has an entity reference to the Product Availability taxonomy)
Product Availability (Taxonomy)
All Products (View - with the Product Availability view as a field)
Product Availability (View)


Now, for each product displayed on my Products view I'd like to show the 'Product Availability' view fields, only for that product. For example, Product A might have the availability 1 and 2, whilst Product B may have only the availability 3. So I only want to show the availability for each product. I'm not sure how I'm supposed to set up a contextual filter for this, or if even that's the right way of doing this.

I somehow need to pass reference to my child view, Product Availability, the node ID of the product I would imagine.

Any suggestions?

EDIT: I've managed to get the result I wanted by going at this in a bit of a backward way. Instead of trying to configure the filter at the level of each product, I've set it up to be on the level of the Product Availability content type. Obviously this isn't as user-friendly, as to relate a 'Product Availability' to a 'Product' this way, you'll need to go into the 'Product Availability' content type and then select the products individually.
Follow the following steps:
Part one:
1. Install Views field view module and REST Export Nested (https://www.drupal.org/project/rest_export_nested)
2. First Create a View filtered by the content type mentioned, selecting Rest Export View.
3. Then Add nid, title and the special field Called "View" https://screencast.com/t/3la2zG6llfi
4. Duplicate this view as Rest Export Nested.



Part two:


Go and create another view filtered by taxonomy terms of your type(Product Availability), selecting Rest Export View.
Add as fields what you want to display for each term. For example, you can add the title of the term, and other fields.


I added 2 fields for example.
3. Add as the relationship the field name which is referenced to the taxonomy (Product Availability) from your content type(Products).
My content type is article and it has field_taxonomy which is a reference to the taxonomy term.
4. The last step on configuring this view is to add a contextual filter: Add "ID" and select to use the relationship created before,
selecting the "Provide default value" and choosing "Content id from URL".

5. Save this view.

Return to the first view created and configure the "View" field as the print screen is showed:
Choose the second view created in the "View " drop-down and o display "rest export". For contextual fields write the {{ raw_fields.nid }} . It will work only if you were added the node id as a field in this view above the "View" field.


The result will be the following:

Node id 1 has 2 field taxonomy terms assigned: "term 1" and "term 2", and in the view object, you can see that there 2 arrays, each array represents a taxonomy term with the fields values.