Woocomerce: Display order number

I really hope you can help. I want to be ble to display the WC stock status in the order mails for the customer.

  • Predrag Dubajic
    • Support

    Hi Mathias,

    Hope you're well.

    I'm afraid that I was unable to find a solution for this and only way seems to be custom coding.
    What I did find that might be useful is this guide for creating Custom WC emails:
    https://www.skyverge.com/blog/how-to-add-a-custom-woocommerce-email/
    And this plugin for Stock alerts:
    https://wordpress.org/plugins/woocommerce-product-stock-alert/

    Perhaps the way that above plugin works can help you with including stock number in default email.

    If you need to customize this then you can post a job in our jobs board where you can hire a developer to assist further:
    https://premium.wpmudev.org/wordpress-development/
    Please note that, no WPMU official staff members are allowed to work in the job board.

    Best regards,
    Predrag

    • Mathias
      • The Bug Hunter

      Actually I have found this: https://stackoverflow.com/a/45220168 and it almost works, as I can display the meta in the order email and it will display an estimated delivery for in stock and backorder products. The only problem is, that I have a custom stock status called "bestillingsvare", and want to display an estimated delivery for this also.

      Do you know any way of tweaking the code a bit, so I can display an estimated delivery based on the "bestillingsvare" status.

      • Adam Czajczyk
        • Support Gorilla

        Hey Mathias!

        How that custom stock status was created?

        If it's been made with one of the "custom stock status" plugins it would be best to reach out to the developer of such plugin to ask him how to read that status in your own code (e.g. if it's some sort of a custom data in the database or is it just a custom field or some post meta value?). If it was created with some non-plugin code, the question is how it's added to the product or, rather, where it's stored.

        For example, if it was just a custom field, you would use "get_post_meta()" function to read it's value. That would most likely go in place of

        $stock = $product_obj->get_stock_quantity();

        in the code that you found. That's just an example but would hopefully give you some idea which direction to explore :slight_smile:

        Best regards,
        Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.