Skip Navigation

[Résolu] I need a special type for woocommerce product variations

This support ticket is created Il y a 8 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.

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 5 réponses, has 2 voix.

Last updated by marc-andre Il y a 8 années et 5 mois.

Assisted by: Luo Yang.

Auteur
Publications
#343313

I have a bunch of woocommerce product to sell. Let's said it's honey. Honey come in different package and size. Like this :

• 500g : 6,50 $
• 1kg : 11,50 $
• 3kg : 24,00 $
• 13.6kg : 105,00 $
• 300kg : call for price

Obviously, some are easier to ship that other. The game plan is offer to buy online the 500g, 1kg, 3kg ONLY. So the question is, how to setup woo to make ONLY those variation to be able to have a "add to cart" button?

I figure out that a custom field link to each variation should do. Let's call this field (online) with a value of true or false, and i check if true then show add to cart button, it false, dont show button...

now, i can add custom field to product, but how to add it to variations ? i have no clue ! HELP

#343328
#343511

Dear marc,

Woocoomerce variation product is a non-public custom post type, which is using slug "product_variation", you can find it in your database table "wp_posts".

If you need add more custom fields in variation product post, please try this:
1) to set variation product post type as public, for example, add below codes in your theme/functions.php

add_filter('woocommerce_register_post_type_product_variation', 'my_func1');
function my_func1($arr){
	$arr['public'] = true;
	return $arr;
}

2) go to WP admin side:
Dashboard-> Types-> Custom fields
add a new custom field group, in section "Where to display this group", you should be able to see post type "Variations", here you can setup your custom checkbox field

3) Dashboard-> Variations
In the sidebar of wordpress dashboard, you should be able to see the post type "Variations", here you can set custom fields value for each Variations post.

#343946
venteenligne.jpg

OK, it's kind of weird. The function work, make variation availible for type -> yeh !

but the concept of having all variation listed on the side as as type and be able to modify the custom field there is akward. what i am look for is the custom filed in the drop down of the product variation

as see on the mockup screen capture, this is where i need it... where i expect to see it. It will be not only convinient, it's where it should be, because it's where i ask for (in variations)

#343955

Sorry, the screenshot you mentioned above is within Woocommce UI, which is out the scope of Toolset, I suggest you try Check out our certified partners for it:
https://toolset.com/consultant/

#347768

i did it myself base on the link I provide... thansk anyway

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.