Force WooCommerce Widgets to Appear in Sidebar or Off-Canvas Filter

This is a Developer Level doc.

If you're unfamiliar with PHP and/or editing files, codes and templates, as well as with resolving possible conflict, please seek help from a professional. Under our Support Policy, we don't provide support for modifications and customization.

If your WooCommerce widgets are not appearing in Sidebars or Off-Canvas Filter even after you have performed database update, use the following PHP snippet to force widgets to display:

/**
* Force WooCommerce Database Update
*/
function update_woocommerce_version() { 		
	if( class_exists( 'WooCommerce' )) { 			
		global $woocommerce; 			 			
		if ( version_compare( get_option( 'woocommerce_db_version', null ), $woocommerce->version, '!=' )) { 		
			update_option( 'woocommerce_db_version', $woocommerce->version ); 		 	
			if( ! wc_update_product_lookup_tables_is_running() ) {
				wc_update_product_lookup_tables();
			} 
		}	
	}		 	
}
add_action( 'init', 'update_woocommerce_version' );

All PHP snippets should be added via a child theme's functions.php file.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.