Created
January 11, 2017 09:17
Star
You must be signed in to star a gist
Update date meta for WooCommerce schedule product with WPUF fields
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
function update_product_schedule_date_meta( $post_id ) { | |
$dates_from = get_post_meta( $post_id, '_sale_price_dates_from', true ); | |
$dates_to = get_post_meta( $post_id, '_sale_price_dates_to', true ); | |
$dates_from = strtotime($dates_from); | |
$dates_to = strtotime($dates_to); | |
update_post_meta( $post_id, '_sale_price_dates_from', $dates_from ); | |
update_post_meta( $post_id, '_sale_price_dates_to', $dates_to ); | |
} | |
add_action( 'wpuf_add_post_after_insert', 'update_product_schedule_date_meta' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment