Skip Navigation

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

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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+01:00)

This topic contains 4 replies, has 2 voices.

Last updated by Francisco Ramón Molina Busquiel 6 years, 6 months ago.

Assisted by: Nigel.

Author
Posts
#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

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01: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

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01: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.

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.