Skip Navigation

[Resolved] Showing custom field on woocommerce product 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.
This support ticket is created 7 years, 4 months ago. 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
- 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 -
- 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 3 replies, has 2 voices.

Last updated by Noman 7 years, 4 months ago.

Assisted by: Noman.

Author
Posts
#549430
4.PNG
3.PNG
2.PNG
1.PNG

hi there,

I'm working on a website where we use Woocommerce. I'm using the free version of Toolset.

With each product it's possible to upload mp3 files as samples. This works. This is the upload-sample-file slug (see screenshot 2). The way the code is built, show that it works on the frontend (cart.php).

I've made a second 'custom type' called 'Video Samples'.

How do I make this second custom type visible in php, showing on cart.php? And how do i say to it that is has to behave as an individual custom type for each product in woocommerce?

#549441

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Dave,

Thank you for contacting Toolset Support.

1. And how do i say to it that is has to behave as an individual custom type for each product in woocommerce?
==> The “Video Samples” custom post type, if you have created using Toolset Types then it should be visible on the backend as individual custom type.

==> If you have created custom post type with code, then please follow this doc so that it can be managed by Types: https://toolset.com/faq/how-do-i-convert-existing-custom-types-and-fields-to-types-control/

==> To make relation between Products and Video Samples (CPT), you will to create relationship between them using Types, you will the options to set ‘parent” or “child” when you edit a post type with Types. More info:
https://toolset.com/documentation/toolset-training-course/part-8-one-to-many-relationships-in-toolset/

2. How do I make this second custom type visible in php, showing on cart.php?
==> For this please explain a bit more, I am not getting what you are trying to achieve here. Do you want to show custom fields on cart.php or you want to show Posts on cart.php or something else?

Thank you

#549457

Hi Noman,

Thanks for your fast reply:

1. I've seen it's visible on the backend with each backend product-edit page. Thanks!

2. Yes i want to show the custom fields on cart.php. The information what i fill in in the custom fields 'Video Samples', is what i want to show. So that will be some video's.

Because the custom type 'mp3' is working, i need to know what to do (for exampe adding extra code) to show the video samples at cart.php . The images i posted with the php code, Is (from what I believe) the code what's needed to show the mp3-files at cart.php . I thought it's something with copying the code and changing the id's and variables, but this didn't work out for me.

Thanks in advance

#549475

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

There is no builtin option in Types to do that but that will need advance custom coding using Types API you can show fields, there are examples on this page general example as well as example codes for each field type: https://toolset.com/documentation/customizing-sites-using-php/functions/

We cannot consult on custom code as this is out of support policy (https://toolset.com/toolset-support-policy/). If you would like you can contact Toolset recommended consultants to further discuss the custom approach. We have some recommended list of service providers here if you would like to take a look: https://toolset.com/consultant/

This tutorial may come handy: hidden link

Thank you

The forum ‘Types Community Support’ is closed to new topics and replies.