Support

Account

Home Forums General Issues Connect a Product page with CPT using Post Object Reply To: Connect a Product page with CPT using Post Object

  • You need to make your field “bidirectional”, in other words, there would be a relationship post on the product page that relates the product to all the posts where it is related using the post object field on the CPT. This would likely mean updating every post. There is an explanation of doing this here https://www.advancedcustomfields.com/resources/bidirectional-relationships/ and there are exiting plugins that will make relationship and post object fields bidirectional https://www.google.com/search?q=acf+budirections+relationship

    If the prospect of updating every post does not appeal to you then you’ll need to do a reverse relationship query when showing the product. Basically, you need to do a WP_Query() looking for any posts that have the product ID set in the field for the CPT.

    In either of the above cases you’ll need to edit the WooCommerce templates or create filters to show the information on the product page. https://www.advancedcustomfields.com/resources/how-to-get-values-from-another-post/