Hi @nanasflowers,
This is not currently a feature of our plugin, though I imagine you could do it in code. You’d need to hook into the purchase flow using one of the WooCommerce actions, and then check the list of tabs for the given product and pull out the one you want.
You’ll need to do this in PHP by adding code to the functions.php
file in your theme folder. I modified code from StackOverflow, so I haven’t tested it, but something like this should work:
add_action('woocommerce_new_order', 'add_tab_note', 1, 1);
function add_tab_note($order_id)
{
// Load the current order
$order = new WC_Order($order_id);
// Grab the products in this order
$products = $order->get_items();
// Stop if there are no products in the order
if (!isset($products) || empty($products)) {
return;
}
// Grab the first product so we can fetch the tabs
$product = $products[0];
// Grab the tabs
$tabs = get_post_meta($product->get_id(), 'yikes_woo_products_tabs', true);
// Stop if there are no tabs
if (!isset($tabs) || empty($tabs)) {
return;
}
// Define the ID of the tab that you want
$id = 'my-tab-id';
// Loop through the tabs
foreach ($tabs as $tab) {
// If the tab matches the desired ID
if ($tab['id'] === $id) {
// Store the content in a variable (assuming that's what you want)
$note = $tab['content'];
}
}
// If the note is defined (meaning the tab was found)
if (isset($note)) {
// Add the note
$order->add_order_note($note);
}
}
You’ll just need to change the ID to the tab ID that you want to use. I’d recommend testing this on staging or locally first.
Let me know if that helps,
Jon