Snippets

Visser Labs Convert custom Product Type values to standard Product Types in Product Importer Deluxe

Created by Michael Visser

File functions.php Added

  • Ignore whitespace
  • Hide word diff
+<?php
+function custom_woo_pd_is_valid_product_type( $output, $product_type ) {
+
+    // All strings are sanitized and in lowercase case without spacing
+
+    // Set all Product Type values of "Variabile" to "Variable"
+    if( $product_type == 'variabile' )
+        $output = 'variable'; 
+    // Set all Product Type values of "Simple Product" to "Simple"
+    if( $product_type == 'simpleproduct' ) 
+        $output = 'simple';
+
+    return $output;
+
+} 
+add_filter( 'woo_pd_is_valid_product_type', 'custom_woo_pd_is_valid_product_type', 10, 2 );
+?>
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.