Skip to content

Instantly share code, notes, and snippets.

@EricBusch
Created December 10, 2017 15:00
Show Gist options
  • Save EricBusch/3dc611f1f23e140af634d2a9d109b225 to your computer and use it in GitHub Desktop.
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]
<?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