Skip Navigation

[Resolved] Display woocommerce children of a grouped product in a custom template

This support ticket is created 6 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by davidZ-4 6 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#898483

Tell us what you are trying to do? create a woocommerce custom product template that display the children of the parent product

Is there any documentation that you are following?
https://toolset.com/learn/create-an-ecommerce-wordpress-site/single-product/

Is there a similar example that we can see?
hidden link
hidden link

What is the link to your site?
hidden link

I created a single product template and i'm trying to figure a way to display the children of these product on the parent product page.
the parent child relationship is done via woocommerce grouped product type and simple product type. the grouped product is the parent and the simple product is the child.
the relationship is set in the grouped product in the "meta:_children"

i tried to create a view that show the children by post relationship but that doesn't work.
i created a shortcode that pull the children post_id and try to create a child view that and pass the values as query string however it seems that the view can get only one id and not an array of id's.

see an example of parent product displaying one child out of two (bottom of the page)
hidden link

bid - child products array

is there a way to create a view that accept the array of product id's and display the results for only the id's that were in the array?

Please advise,

David

#900244

Dear David,

For the question:
is there a way to create a view that accept the array of product id's and display the results for only the id's that were in the array?

Yes, you can try with the Views "post ID" filter, see our document:
https://toolset.com/documentation/user-guides/filtering-views-query-by-post-id/

The post ID filter for Views allows to return or exclude one or several posts by their IDs. You can also add the IDs as a URL parameter or an attribute when you add your Views shortcode to a page.

#900277

Great, this works great !
Thanks,