Skip to content

Instantly share code, notes, and snippets.

@code-flow
Created May 3, 2017 07:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save code-flow/8679356d6dbacdda0ae38ff433e42a46 to your computer and use it in GitHub Desktop.
Save code-flow/8679356d6dbacdda0ae38ff433e42a46 to your computer and use it in GitHub Desktop.
Correct import behaviour when WPAllImport is used.
<?php
/*
Plugin Name: Countdown Import Helper
Description: Correct import behaviour when WPAllImport is used.
Version 0.1.0
*/
add_action( 'pmxi_saved_post', 'cdih_save_post', 10, 1 );
function cdih_save_post( $post_id ) {
if ( ! function_exists( 'wc_get_product' ) ) {
return;
}
$product = wc_get_product( $post_id );
if ( $product ) {
# works for simple products
update_post_meta( $post_id, '_wpbpc_product_id', $post_id );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment