Created
December 10, 2017 15:00
-
-
Save EricBusch/3dc611f1f23e140af634d2a9d109b225 to your computer and use it in GitHub Desktop.
Change a product's type from "external" to "simple" during a Product Set import/update. [datafeedr][dfrps][dfrpswc]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Change product type from 'external' to 'simple'. | |
*/ | |
function mycode_change_postmeta_product_type( $meta, $post, $product, $set, $action ) { | |
$meta['_product_type'] = 'simple'; | |
return $meta; | |
} | |
add_filter( 'dfrpswc_filter_postmeta_array', 'mycode_change_postmeta_product_type', 20, 5 ); | |
/** | |
* Change product type from 'external' to 'simple'. | |
*/ | |
function mycode_change_taxonomy_product_type( $taxonomies, $post, $product, $set, $action ) { | |
$taxonomies['product_type'] = 'simple'; | |
return $taxonomies; | |
} | |
add_filter( 'dfrpswc_filter_taxonomy_array', 'mycode_change_taxonomy_product_type', 20, 5 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment