Skip Navigation

[Resolved] outputting woocommerce product fields in product template

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 1 reply, has 2 voices.

Last updated by Minesh 1 year, 4 months ago.

Assisted by: Minesh.

Author
Posts
#2633733

I am trying to output some Woocommerce product fields here https://toolset.com/course-lesson/enabling-additional-woocommerce-fields-in-product-forms/ in a template—specifically I want to check if there are sale price dates set for a product, and output _sale_price (if it's not empty) and _sale_price_dates_to. I tried evaluating and outputting [types field='views_woo_sale_price'][/types] but that doesn't do anything...

#2633903

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

What if you try to use the following shortcode to display the regular price and sale price:

[wpv-post-field name="_regular_price"]
[wpv-post-field name="_sale_price"]

Also, you can use the same shortcode to get the value of the date:

[wpv-post-field name="_sale_price_dates_from"]
[wpv-post-field name="_sale_price_dates_to"]

Does that help?

You can use the conditional shortcode to display the fields conditionally:
=> https://toolset.com/documentation/legacy-features/views-plugin/#conditional-output-in-views