Hi,
you can use hidden field input, where you can set static value but it’s PRO feature.
Is it possible for per product?
If yes then can u send me a demo link and link to buy pro product. I would like to use that..
Main thing is I NEED TO SET DEFAULT VALUE PER PRODUCT..
And if its possible by doing some simple code then let me know.
-
This reply was modified 6 years, 11 months ago by
jasmeetsingh.
If this is for a static value for each product then you can use a custom field instead. It is built into WordPress and can be tied into WooCommerce products because they are just posts.
It can be set in each product under the Custom fields box. You would have to use the Add New Custom Field: to create the field and then set it after you create it. If you don’t see it under a product then you need to change the Screen options to show Custom Fields.
To programmatically retrieve it you could use the following:
global $post;
$custom_field_name = get_post_meta($post->ID,"custom_field_name",true)
You could also use get_post_custom_values(), get_post_custom() or get_post_meta() if there is more than one value for the custom field you specify or you want to reference more than one custom field in a single script.
For detailed information:
https://ww.wp.xz.cn/support/article/custom-fields/
https://developer.ww.wp.xz.cn/reference/functions/get_post_meta/
HOWEVER
If you are looking to programmatically bind a custom value to a product as it is being configured then PPOM hidden fields are your best bet and you would need the PRO version.
-
This reply was modified 6 years, 11 months ago by
brozra. Reason: spelling error
-
This reply was modified 6 years, 11 months ago by
brozra. Reason: removal of recommendation
Thanks @brozra for sharing more details.