[Resolved] Get uploaded filed URL custom woocommerce field
This support ticket is created 4 years, 11 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.
Hello, I have a custom woocommerce field that requires customers to upload a bio picture. I'm now attempting to display that custom field in a view, but I only need the url of the image to display in the view.
I can successfully retreive file information. with [wpv-post-field name="shared_bio_pic"]
but the info returned is not usefull to me, how do I go about getting just the URL of the file upload?
Toolset doesn't understand 3rd-party custom fields as anything other than the strings they are always saved as in wp_postmeta.
It looks like your custom field is converted to JSON from an object before storing as post meta.
In which case it needs converting back to an object upon retrieval, and then you can extract the part you need, i.e. just the URL.
That's not something you can do with Toolset.
You will likely need a custom shortcode which retrieves the data and returns just the URL.
That's outside the scope of our support, but let me offer an example that you can try. If it doesn't work you'll need to debug it yourself or get a developer to do it for you.
Add this to a snippet at Toolset > Settings > Custom Code (be sure to activate it on the front-end):
You can then use the shortcode [field-url] where you want the URL to be shown. It defaults to the field "shared_bio_pic" but you can overwrite that with a field attribute.