Skip Navigation

[Résolu] Display woocommerce children of a grouped product in a custom template

This support ticket is created Il y a 6 années et 6 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

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)

Ce sujet contient 2 réponses, a 2 voix.

Dernière mise à jour par davidZ-4 Il y a 6 années et 6 mois.

Assisté par: Luo Yang.

Auteur
Publications
#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?
lien caché
lien caché

What is the link to your site?
lien caché

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)
lien caché

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,