[Closed] Showing custom field on woocommerce product page

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.

Our next available supporter will answer your ticket in about 7.13 hours from now. Thank you for your understanding.

Related documentation: Adding Custom Fields to WordPress

This topic contains 3 replies, has 2 voices, and was last updated by  Noman 4 months ago. The support staff assigned to this topic is Noman.

Viewing 4 posts - 1 through 4 (of 4 total)
Author
Posts
#549430

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
Forum moderator

Supporter languages: English (English )

Supporter 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://wp-types.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://wp-types.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
Forum moderator

Supporter languages: English (English )

Supporter 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://wp-types.com/documentation/customizing-sites-using-php/functions/

We cannot consult on custom code as this is out of support policy (https://wp-types.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://wp-types.com/consultant/

This tutorial may come handy: hidden link

Thank you

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘[Closed] Showing custom field on woocommerce product page’ is closed to new replies.