Created
May 3, 2017 07:40
-
-
Save code-flow/8679356d6dbacdda0ae38ff433e42a46 to your computer and use it in GitHub Desktop.
Correct import behaviour when WPAllImport is used.
This file contains 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 | |
/* | |
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