Hi. I tried to search forum for help but couldn’t find answer for my problem.
I have a base looper and it lists all products from CPT “Products” based on specific taxonomy. This works fine with following query builder:
Posts: Products
Taxonomy: Cleaning
Order by: Date Ascending
Next, I have an inner looper inside base looper for each product. It should list any files from CPT “Documents” if they are in relationship with current product. “Documents” has relationship field “product_ids” (with option to choose multiple products) and in ACF I’ve checked return format to be “Post ID”. For example if there’s two products connected to any file, “product_ids” would return value “123, 345”. Below
are my settings for inner looper and for reason I don’t know all files are always listed for all products so comparing doesn’t work.
Inner Looper Query Builder:
Posts: Documents
Meta Values:
Meta Key: product_ids
Comparison: Like
Meta Value: {{dc:looper:field key=“ID” depth=“1”}}
I have attached screen capture of two first items from the page. As seen in image, base looper first fetches product #735 and prints it’s details, then for connected files it starts the inner looper and finds a document #809 which
has product #735 in file_ids which means it’s connected to the product and should be printed, and that’s fine.
But, then we go to second product #736 which is not included in product_ids yet still same document #809 is listed the very same way. And same happens with any other product.
I am also printing out depth 0 and 1 and they both show correct values, depth 1 prints out current base looper parent product ID and depth 0 current inner looper document ID.
Am i doing/understanding something wrong with ACF relationship field and meta value ?

