Problem: I have created a one-to-many relationship between my CPT Workshops (parent) and WooCommerce Products (child). I would like to display the related Products on the single Workshop page, and include a way to add the product to the cart and show the stock status of each Product.
Solution: Use Views to create a new View of Products, filtered by post relationship, where the post is a child of the current page.
In the Loop Output area, you can insert the Product title / link, an Add to Cart button, and a Product In Stock status indicator using the Fields and Views button, or by copy + pasting this code inside the wpv-loop tags:
[wpv-post-link]<br /> [wpv-woo-buy-or-select]<br /> [wpv-conditional if="('[wpv-post-field name='views_woo_in_stock']' eq '1' )"]In stock[/wpv-conditional] [wpv-conditional if="('[wpv-post-field name='views_woo_in_stock']' eq '1' )" evaluate="false"]Out of stock[/wpv-conditional]
Relevant Documentation:
https://toolset.com/documentation/user-guides/querying-and-displaying-child-posts/
Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
This topic contains 5 replies, has 2 voices.
Last updated by 6 years, 10 months ago.
Assisted by: Christian Cox.
The forum ‘Types Community Support’ is closed to new topics and replies.