Skip to content

Instantly share code, notes, and snippets.

@EricBusch
Last active September 26, 2018 14:32
Show Gist options
  • Save EricBusch/04636ff9db54790ca5ae1ee411b1b766 to your computer and use it in GitHub Desktop.
Save EricBusch/04636ff9db54790ca5ae1ee411b1b766 to your computer and use it in GitHub Desktop.
Import a product image during a Product Set update. [datafeedr]dfrps][dfrpswc]
<?php
/**
* Import a product image during a Product Set update.
*
* This WILL cause product set updates to be slower.
*
* @param array $post Array containing WordPress Post information.
* @param array $product Array containing Datafeedr Product information.
* @param array $set Array containing Product Set information.
* @param string $action Either "update" or "insert" depending on what the Product Set is doing.
*/
function mycode_import_product_image_during_product_set_update( $post, $product, $set, $action ) {
dfrps_import_post_thumbnail( $post['ID'] );
}
add_action( 'dfrpswc_do_product', 'mycode_import_product_image_during_product_set_update', 20, 4 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment