Hi,
I have a Woocommerce site, with added custom field to Product
Field: produkta-pazinojumi
Field type: checkboxes
Each product can have a different checkbox selected, it is like additional info for a particular product.
What I would like to, is to display selected values on a single product page > Additional Info tab
Currently, it displays dimensions info.
What is the link to your site?
hidden link
Hi there,
You need to use Woocommerce hooks for that. A potential solution can be this:
hidden link
Also to retrieve a custom field you can use this method:
https://toolset.com/documentation/customizing-sites-using-php/functions/#checkboxes
add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 );
function woo_rename_tabs( $tabs ) {
global $product;
$tabs['additional_information']['callback'] = 'chr_add_additional_information'; // this is the function name which is included below
return $tabs;
}
function chr_add_additional_information(){
woocommerce_product_additional_information_tab(); // This function calls wc_get_template( 'single-product/tabs/additional-information.php' );
echo ( types_render_field( "produkta-pazinojumi", array( "separator" => ", " ) ))
}
The echo ( types_render_field( "produkta-pazinojumi", array( "separator" => ", " ) )) portion of the code retrieves the checkboxes and separate the values with comma.
You can add the code as a custom file to Toolset using the method below:
https://toolset.com/documentation/programmer-reference/adding-custom-code/using-toolset-to-add-custom-code/
Finally please be aware of this errata as you want to retrieve checkboxes:
https://toolset.com/errata/checkboxes-that-save-0-are-interpreted-as-checked-by-views/
Kindly consider that the request is a custom development one and outside of our support scope. We did our best to give you the pointers to get started with the feature, but if you need additional help you'd better consider hiring a developer.
Thank you.