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
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.
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)
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/
i did it myself base on the link I provide... thansk anyway