• Resolved Robert

    (@baxzibi)


    Missing “Create Date” on Draft Products – Possible Bug

    Hi Team,

    I’m not sure if you’re aware, but since the last update (or possibly the one before), all products created and saved as drafts no longer have a “Create Date” assigned — the field is currently empty.

    This seems like a bug.

    Could you please advise on a quick fix or workaround for this issue?

    WooCommerce version: 9.8.2
    WordPress version: 6.8

    Steps to reproduce the problem:
    1. Create new product
    2. Save as Draft

    In the meantime, Action taken:
    1. Try disabling any plugins that might interfere with product creation: done
    2. Check if the issue persists across different themes: done

    Best regards,
    Robert

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Hi @baxzibi,

    Thanks for reaching out and for outlining the steps so clearly.

    I tested this on WooCommerce 9.8.2 with WordPress 6.8 and wasn’t able to replicate the issue—draft products are showing a “Date” as expected. Here’s a screenshot for reference:

    👉 https://snipboard.io/5RQSFk.jpg

    It’s possible we might be looking at a different area or field than you are. When you get a moment, could you please share a screenshot of where the “Create Date” appears missing on your end? That’ll help us pinpoint exactly what’s going on.

    Looking forward to your reply!

    Thread Starter Robert

    (@baxzibi)


    Steps which was done:
    1. All plugins and Template enable:
    Product ID: 30097

    2. Only left Elementor. Elementor Pro plugin and Template
    Product ID: 30099

    3. Elementor, Elementor Pro wit Default template
    ID: 30100

    4. All plugin disabled with Default template
    ID: 30101

    I’m happy to provide access to my website if needed

    Thread Starter Robert

    (@baxzibi)

    Only post_date_gmt is 0000-00-00 00:00:00 where all other dates are correct:
    post_date – correct
    post_modified – correct
    post modified_gmt – correct

    Hi @baxzibi,

    Thanks for reaching out. The post_date_gmt column stores the date and time a post is published. For draft posts, this value isn’t set yet, which is why it appears as 0000-00-00 00:00:00. It only gets filled in once the post is published.

    For drafts, only the modified date and time are recorded which is the expected behavior.

    Thread Starter Robert

    (@baxzibi)

    I’m verry disappointed you response.

    In meantime I found article which describe issue.
    I know that by SQL request I can fix this by myself, but this is definitely bug, which affecting not only me.
    Making update by SQL did not resolve the issue.
    https://ryansechrest.com/2013/02/no-value-for-post_date_gmt-and-post_modified_gmt-when-creating-drafts-in-wordpress/

    Thread Starter Robert

    (@baxzibi)

    SQL UPDATE

    -- Update for post_date_gmt
    UPDATE wp_posts
    SET post_date_gmt = CONVERT_TZ(post_date, '+00:00', '+00:00')
    WHERE post_date_gmt = '0000-00-00 00:00:00' AND post_date != '0000-00-00 00:00:00';

    -- Update for post_modified_gmt
    UPDATE wp_posts
    SET post_modified_gmt = CONVERT_TZ(post_modified, '+00:00', '+00:00')
    WHERE post_modified_gmt = '0000-00-00 00:00:00' AND post_modified != '0000-00-00 00:00:00';
    PHP code for functions.php or added in Snippets:

    add_action('save_post', function ($post_id, $post, $update) {
    // Wyklucz autosave, revision, trashed i post types bez dat
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;
    if (wp_is_post_revision($post_id)) return;
    if (get_post_status($post_id) === 'trash') return;

    global $wpdb;

    $post_type = get_post_type($post_id);
    $allowed_types = ['post', 'page', 'product']; // dodaj inne typy jeśli trzeba

    if (!in_array($post_type, $allowed_types)) return;

    $post_obj = get_post($post_id);
    $post_date = $post_obj->post_date;
    $post_modified = $post_obj->post_modified;

    $post_date_gmt = $post_obj->post_date_gmt;
    $post_modified_gmt = $post_obj->post_modified_gmt;

    // Uzupełnij tylko jeśli gmt = '0000-00-00 00:00:00'
    if ($post_date_gmt === '0000-00-00 00:00:00' || $post_modified_gmt === '0000-00-00 00:00:00') {
    // WordPress przelicza strefy automatycznie
    $gmt_post_date = get_gmt_from_date($post_date);
    $gmt_post_modified = get_gmt_from_date($post_modified);

    $wpdb->update(
    $wpdb->posts,
    [
    'post_date_gmt' => $gmt_post_date,
    'post_modified_gmt' => $gmt_post_modified
    ],
    ['ID' => $post_id]
    );
    }
    }, 10, 3);

    @mosesmedh and @mahfuzurwp

    And No guys, was not resolved by support. This issue still required correction.
    This is system fault described below:
    https://ryansechrest.com/2013/02/no-value-for-post_date_gmt-and-post_modified_gmt-when-creating-drafts-in-wordpress/

    Hi @baxzibi,

    Thanks for following up and for sharing the detailed info along with that article—very insightful.

    You’re absolutely right that this behavior stems from how WordPress handles drafts at the database level. Specifically, post_date_gmt isn’t populated for drafts because WordPress only assigns that timestamp when a post is published. While this does affect how some systems reference or sort draft products, it’s part of WordPress core behavior and not something WooCommerce directly controls.

    We understand how this can be frustrating, especially when it impacts your workflow. Since this relates to core post data handling in WordPress, we recommend sharing your findings directly with the WordPress core team, as they’re best positioned to address or reconsider this logic. You can do that here:

    👉 https://core.trac.ww.wp.xz.cn/

    Thread Starter Robert

    (@baxzibi)

    Zee

    (@doublezed2)

    Hello Robert,

    Thank you for your reply.

    I understand you have created a ticket at https://core.trac.ww.wp.xz.cn/ticket/63348. I appreciate your contribution to the WordPress community.

    If you have any more questions or concerns, feel free to reach out. We are here to help 🙂

    Best regards.

    Plugin Support Kay U a11n

    (@kingsleyinfo)

    If you have a few minutes, we’d love if you could leave us a review: https://ww.wp.xz.cn/support/plugin/woocommerce/reviews/

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Missing “Create Date” on Draft Products – Possible Bug’ is closed to new replies.