Skip Navigation

[Resuelto] Variable subscription price (Woocommerce subscription) and Toolset

This support ticket is created hace 6 años, 11 meses. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

Etiquetado: ,

Este tema contiene 4 respuestas, tiene 2 mensajes.

Última actualización por Francisco Ramón Molina Busquiel hace 6 años, 11 meses.

Asistido por: Nigel.

Autor
Mensajes
#600603

If I want to show a price table (DIVI module) for a subscription based on the 'variable subscription' type of a woocommerce subscription product, with Toolset can I show the price of each of the variations?
That is, can I show the price of a certain variation of a particular product?
Thanks for your help.
Best regards,
Francisco R.

#600788

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

Hi Francisco

The WC Subscriptions extension stores the prices for variable products the same way that standard WooCommerce variable product prices are stored, which is in a proprietary way that is not readily accessible to Toolset.

Views includes shortcodes to display the product prices, but using WooCommerce's own API to output the standard UI.

You can display individual prices from the product variations, but this is somewhat brittle (i.e. it can break easily).

When you create a product with variations, the prices of these are stored as post meta with a key of "_price". If you create four variations, there will be four "_price" entries for the post in wp_postmeta.

There is no easy way to connect these prices to the variations, except that they are in the same order as the variations are initially added to the product when first saved. If you re-order the variations on the product edit page, the _price fields do not change.

But if you create the product variations and do not change the order, then you can output the prices using the wpv-post-field shortcode with the index attribute to specify which _price field to output.

This will display the prices of the variations separately, for example:

<p>First variation: [wpv-post-field name='_price' index="0"]</p>
<p>Second variation: [wpv-post-field name='_price' index="1"]</p>
<p>Third variation: [wpv-post-field name='_price' index="2"]</p>
<p>Fourth variation: [wpv-post-field name='_price' index="3"]</p>

That's the only solution I know that doesn't involve writing a custom solution using WooCommerce's API.

#600793

Thank you very much for your explanation Nigel.
I guess that these shortcodes work if the page of the product is being rendered, if I wanted to put them on any other page, I could do it?

#600794

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

Yes, then you would need to use the id attribute in the wpv-post-field shortcode with the ID of the product so that the shortcode knew which post to get the fields from.

#600799

Ok. Perfect. I will try everything you have told me on my website.
Thank you very much for your help Nigel.