Sauter la navigation

[Résolu] Custom field for product variation

This support ticket is created Il y a 4 années et 5 mois. 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.

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

Ce sujet contient 5 réponses, a 3 voix.

Dernière mise à jour par kenB-4 Il y a 4 années et 5 mois.

Assisté par: Nigel.

Auteur
Publications
#1723645

Wish to add Types Custom Field to product variation.
Found a post in support forum 2015 says not possible.

Is this feature available today?

#1723779

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

No, there haven't been any changes with this since then.

Product variations are a private post type internal to WooCommerce, and Types doesn't provide any way of making the post type public and adding fields to it.

WooCommerce does allow you to filter the arguments used to register its post types so you could make it public, then assign a field group to it, but it wouldn't help much with the UI for adding data to the fields, because you don't normally edit product variation posts.

The WC API lets you do this, and if you don't want another paid plugin you can do it programmatically. I found this guide, which promotes a paid plugin, but also describes how to do it yourself in code: lien caché

No doubt there are other guides available if you want to explore more.

#1724141

I see.
Maybe I'm looking to the wrong direction.
I'm building an e-commerce site for a magazine publisher. 3 subscription periods(variations) per magazine(product). The final task is to export orders with some custom data. This custom data varies by period of certain magazine.
Any good idea how to set it up without Woocommerce product variations with Toolset tools?

#1726651

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

Sorry for the delay getting back to you, I had a public holiday yesterday.

I think the problem is that you need the product variations, because at a minimum each subscription period will have a different price. When you create product variations WC creates separate posts for each variation, each of which can have its own product details such as price.

The only way you could achieve something similar without using variations themselves would be to have individual products such as "Magazine A - 3 months", "Magazine A - 6 months" etc., which will involve lots of unnecessary duplication and is far from ideal.

#1730227

Right, variations is the way to go.
Will look some php workaround.

Thank you for chatting!

#1938871

I've been searching the internet for days to solve this same problem. My client sells leather and needs to search it by color. Obvious solution is to have each color as a product variation, and this works fine. For example, "suede" would be the product, and individual colors ("sunset", "bamboo", "American clay", etc) are variations.

But we need to use a standard list of color names (red, blue, brown, etc.) and often a variation will fall under more than one color. IE: "American clay" could fall under both grey and brown.

My thought is that I need to apply tags to individual variations similar to how you can for the product as a whole. I'm amazed that there literally seems to be no solution for adding custom fields to product variations!

You've mentioned that there are other plugins that might do this. would you mind sharing them? Or even the guide you reference (shows up as a hidden link for me)