Tips on how to Create A Product Dimension Chart in Woocommerce?

On this brief tutorial I’ll present you easy methods to create a product measurement chart in Woocommerce. It’s pretty simple and can take solely a few minutes to arrange. And, the answer is completely free, though with the assistance of a premium code snippet supervisor (WpCodebox, for instance) you’ll be able to obtain rather more. However, let’s soar in.

Video: Tips on how to Create A Product Dimension Chart in Woocommerce?

In case you haven’t used any snippets supervisor earlier than, and also you want to know extra about it, then see this video right here beneath. In it I’ll exhibit easy methods to create a product measurement chart in Woocommerce.

Tips on how to Create A Product Dimension Chart in Woocommerce?

Now, with a purpose to add measurement carts to a single product web page in Woocommerce, there are a few steps we have to do.

Step 1: Set up Reusable Blocks Prolonged plugin

This plugin extends the Reusable Blocks admin interface, and it gives you a Reusable Blocks Shortcode to make use of your block wherever you need in your Submit sorts (even when they use the Basic Editor reasonably than Gutenberg!).

So, obtain and set up Reusable Blocks Prolonged plugin as a result of we want it to create product measurement charts in a manner that we are able to add it to our single product pages later.

Step 2: Code Snippets or WpCodebox plugin

Earlier than we begin, I’ve to say that each one the snippets you see beneath must be added to your baby theme’s capabilities.php file or higher but, use a snippet supervisor like Code Snippets or WpCodeBox (my favourite). If you happen to’re , then seize WPCodeBox with a pleasant 20% low cost right here (SAVE 20% Coupon WPSH20).

Step 3: Create measurement chart

Since we put in Reusable Blocks Prolonged plugin we are able to use it to create a pleasant measurement chart. Simply go to the Blocks >> Add new and create a measurement chart.

Now, for those who publish it, then you definitely’ll see a shortcode for this chart. It’s beneath Blocks >> All reusable blocks menu. See the screenshot.

How to create product size chart in woocommerce

Step 4: Add a brand new snippet

Now go to Snippets >> Add new and paste this code inside your snippets field. This can create a pleasant button that opens your measurement chart just like the one right here beneath.

Tips on how to Create A Product Dimension Chart in Woocommerce?

Listen, that it’s a must to change the shortcode in line 7. Additionally, if you need to rename the button title then rename it in traces 5, 16 and 21.

// Provides a measurement chart in your Woocommerce Single product web page
 
add_action( 'woocommerce_product_meta_end', 'wpsh_size_chart', 30 );
operate wpsh_size_chart() {
echo '<button kind="submit" id="trigger_cf" class="button alt" type="margin-top: 1em;">Dimension chart</button>';
echo '<div id="product_inq" type="show:none">';
echo do_shortcode("[reblex id='465']");
echo '</div>';
}
 
add_action( 'woocommerce_single_product_summary', 'wpsh_size_chart_1', 40);
operate wpsh_size_chart_1() {
  ?>
    <script kind="textual content/javascript">
        jQuery('#trigger_cf').on('click on', operate(){
        if ( jQuery(this).textual content() == 'Dimension chart' ) {
                    jQuery('#product_inq').css("show","block");
            jQuery("#trigger_cf").html('Shut');
        } else {
            jQuery('#product_inq').disguise();
            jQuery("#trigger_cf").html('Dimension chart');
        }
        });
    </script>
    <?php    
}

Tips on how to Show A Product Dimension Chart in Woocommerce Customized Tab?

Earlier answer created a button that opens your measurement chart. However what if you need to show it in a separate produc tab? See the screenshot.

How to Display A Product Size Chart in Woocommerce Custom Tab?

On this case, use this snippet right here beneath. Listen that you would be able to change your tab title in 6. Additionally, exchange the shortcode in line 15 accordingly.

// Show A Product Dimension Chart in Woocommerce Customized Tab
add_filter( 'woocommerce_product_tabs', 'wpsh_sizechart_tab' );
operate wpsh_sizechart_tab( $tabs ) {	
	// Provides the brand new tab
	$tabs['test_tab'] = array(
		'title' 	=> __( 'Measurement charts', 'woocommerce' ),
		'precedence' 	=> 20,
		'callback' 	=> 'wpsh_sizechart_tab_content'
	);
	return $tabs;
}
operate wpsh_sizechart_tab_content() {
	// The brand new tab content material
	echo '<h2>Measurement charts</h2>';
	echo do_shortcode("[reblex id='465']");	
}

Tips on how to Show A Product Dimension Chart in Woocommerce Conditionally?

Each of those options I described above will show your measurement chart for all merchandise. If you want to know easy methods to show a product measurement chart in Woocommerce conditionally, then you definitely would wish to tweak your code. So, with a purpose to preserve it brief, you’ll be able to check out the thorough tutorial on conditional logic right here.

There’s additionally a a lot simpler option to accomplish all that. And that’s, you should utilize WPCodebox plugin I’ve talked about a few instances already. This manner you should utilize the identical code I confirmed you above with none points. If you want to know easy methods to add these conditional guidelines then see the video above (watch at 6min 54sec mark).

Helpful Woocommerce ideas

  • Tips on how to create, take away, rename and re-order Woocommerce product tabs?

  • Tips on how to Customise Woocommerce Inventory Standing? (17 hacks)

  • Tips on how to Conceal Woocommerce Delivery Strategies (Conditionally) – A Full Information

  • Tips on how to show Woocommerce my account tabs horizontally?

  • Tips on how to Show Woocommerce Fee Strategies Conditionally? (14 hacks)

  • Tips on how to Add Customized Endpoints in WooCommerce?

  • Tips on how to Create Customized Product Badges for Woocommerce?

Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart
Scroll to Top