WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
How to customize the single product variations? (1 post)

  1. kowa
    Member
    Posted 1 year ago #

    Hi,

    how can I add the content of a custom tab to the single product variation?

    My function to display Custom Tab on Frontend of the Website for WooCommerce 2.0 is:

    add_filter( 'woocommerce_product_tabs', 'woocommerce_product_custom_tab' );		
    
    function woocommerce_product_custom_tab( $tabs ) {
       global $post, $product;
    
       $custom_tab_options = array(
    	'enabled' => get_post_meta($post->ID, 'custom_tab_enabled', true),
    	'title' => get_post_meta($post->ID, 'custom_tab_title', true),
    			    'content' => get_post_meta($post->ID, 'custom_tab_content', true),
    		    );
    
    		    if ( $custom_tab_options['enabled'] != 'no' ){
    			    $tabs['custom-tab-first'] = array(
    				    'title'    => $custom_tab_options['title'],
    				    'priority' => 25,
    				    'callback' => 'custom_product_tabs_panel_content',
    				    'content'  => $custom_tab_options['content']
    			    );
    		    }
    
    		    return $tabs;
    	    }
    
          /**
          * Render the custom product tab panel content for the callback 'custom_product_tabs_panel_content'
          */
    	function custom_product_tabs_panel_content( $key, $custom_tab_options ) {
    
    		  echo '<br />';
    		  echo ' <input type="checkbox" name="custom_tab_title" value=' . $custom_tab_options['content'] . '/>' ;
    		  echo ' <label> ' . $custom_tab_options['content'] .  '</label> ';
    
    		  // echo '<h2>' . $custom_tab_options['title'] . '</h2>';
    		  // echo $custom_tab_options['content'];
    
    	  }

    the content of the custom tab should be placed at the right content side.
    I think the content must be placed in the wp-contents/theme/woocommerce/singe-product/add-to-cart/variations.php but I donĀ“t know the right function or hook.

    Thank you!

    http://wordpress.org/extend/plugins/woocommerce/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic