Skip Navigation

[Resuelto] Displaying 2 products on CPT page

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

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/

This support ticket is created hace 6 años, 10 meses. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

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)

Etiquetado: 

Este tema contiene 5 respuestas, tiene 2 mensajes.

Última actualización por sigerS hace 6 años, 10 meses.

Asistido por: Christian Cox.

Autor
Mensajes
#606471

Tell us what you are trying to do?
Hi, I created a CPT called Workshops. With the (beta) one-to-many relationship I want to connect and display two Woo product add to cart buttons and stock statusses (tickets). In the backend I can connect the two Woo products, but I can't manage to display them on the layout page from the Workshop. Is this related to the beta status (not yet completely implemented) or am I missing something.

Is there any documentation that you are following?
https://toolset.com/learn/create-an-ecommerce-wordpress-site/#developing-custom-woocommerce-sites-without-php

Is there a similar example that we can see?
enlace oculto
This is the idea, but is now created manually.

What is the link to your site?
Dev site: enlace oculto

#606924
Screen Shot 2018-01-16 at 5.16.00 PM.png

In the backend I can connect the two Woo products, but I can't manage to display them on the layout page from the Workshop
Okay so it sounds like you have a Workshop single post Layout and you would like to display the two Products that are children of the current Workshop. Is that correct? If so, then you can use Views to do this.
- Create a new View of Products.
- Add a Query Filter to filter by Post Relationship. Configure the Post Relationship filter to select posts that are children of the current post. When you place this View on the Workshop page, the results will include only the Products that are children of the current Workshop. See the screenshot attached for an example of this type of Query Filter.
- 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]
#607130

Hi Christian,

Thank you very much, this is exactly wat I ment! I queried the Workshops instead of the Product.
Siger

#607142

I added [wpv-woo-buy-or-select show_quantity_in_button='yes']

In the frontend this is giving the following HTML;
<input type="number" id="quantity_5a5f3f903e0b1" class="input-text qty text" step="1" min="1" max="2" name="quantity" value="1" title="Aantal" size="4" pattern="[0-9]*" inputmode="numeric">

Where can I change the max="2"? And I miss the little arrows on the right, to increase the amount to add in the Cart.

Thank you!

Los hilos nuevos creados por Christian Cox y vinculados a este se encuentran a continuación:

https://toolset.com/es/forums/topic/customizing-the-add-to-cart-button/

#607146

Hi, our support policy is to limit each ticket to one main issue. I've created a new ticket for the other questions so we can track those separately. Thanks for your cooperation!

https://toolset.com/forums/topic/customizing-the-add-to-cart-button/

#607164

Hi Christian,
I am sorry, will remember that the next time!

El foro ‘Types Community Support’ está cerrado y no se permiten nuevos debates ni respuestas.