Having an issue using the
Advanced Custom Fields
plugin. I've got 2 Custom Post Types
There is a one to many relationship between a supplier and their products. (One supplier has multiple products). I've got a page displaying a list of my suppliers and when I click on a supplier I am taken to
single-pa_supplier page where I would like to display a list of the products associated with that Supplier.
I've successfully managed to make a query on this page and display products, but they are not the corresponding ones to the Supplier.
This works: - It displays a list of products with a quantity of 10,000 as expected
<?php $products = get_posts(array( 'post_type' => 'pa_supplier_product', 'posts_per_page' => '100', 'meta_key' => 'quantity_per_pallet', 'meta_value' => '10000', 'compare' => 'LIKE' ));?>
This does not work: - I was hoping it would display all products that have a supplier called "Cavan Box"
<?php $products = get_posts(array( 'post_type' => 'pa_supplier_product', 'posts_per_page' => '100', 'meta_query' => array( array( 'key' => 'supplier', 'value' => 'Cavan Box', 'compare' => 'LIKE' ) ) ));?>
I don't know why the second query is not working, I've a field called supplier and it is of type Relationship. when I create a product I assign it a supplier. Any help would be much appreciated.