Skip to content

Instantly share code, notes, and snippets.

@mahbubme
Created January 11, 2017 09:17
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mahbubme/34095d7dec7351fdcaf75d560935652e to your computer and use it in GitHub Desktop.
Update date meta for WooCommerce schedule product with WPUF fields
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