WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce Sequential Order Numbers
[resolved] is there a way to start from 1 when year ends without delete all? (12 posts)

  1. outlet2013
    Member
    Posted 4 months ago #

    My question is really simple, i love this plugin and i use order number to print invoice, but when years end fiscal law need that invoice must start from 1.

    So is there a way to start from 1 at 01 gennuary without delete all orders in database?

    http://wordpress.org/plugins/woocommerce-sequential-order-numbers/

  2. SkyVerge
    Member
    Plugin Author

    Posted 4 months ago #

    There's unfortunately no way of starting order numbers back at 1 again, because this would result in duplicate order numbers. The only way would be to export and delete all your previous orders.

    Alternatively, you could take a look at our premium version of the plugin http://www.woothemes.com/products/sequential-order-numbers-pro/ which gives you more control and the ability to add a prefix/suffix, so you could do something like 1-2013, 2-2013, etc and then 1-2014, 2-2014, etc. But if you truly need to have the order numbers repeat you'd have to export and delete the previous years orders I'm afraid

    -- Justin

  3. SkyVerge
    Member
    Plugin Author

    Posted 4 months ago #

    Actually, my apologies, I remembered you actually can't do "1-2013, 2-2013, etc and then 1-2014, 2-2014" like I was first thinking, the incrementing portion of the order number can't be re-used (it's how the plugin determines internally the uniqueness and next order number) so your only option here would be to delete all orders unfortunately

    -- Justin

  4. Jasemin
    Member
    Posted 4 months ago #

    Hi,
    Is there a way to use payment transaction id as order id for my store with this plugin, i tried this but am getting transaction id of previous transaction each time. Is there any way to do this.

    Thanks

  5. SkyVerge
    Member
    Plugin Author

    Posted 4 months ago #

    Ha, interesting question. When you say "payment transaction id" are you talking the transaction id returned from your gateway? If so, there's definitely no way of doing this with the free plugin, you'd need the premium version http://www.woothemes.com/products/sequential-order-numbers-pro/ and even still it would require some custom coding since every gateway is different. Actually, most gateways need an order id sent with the transaction, so if the order number were set *after* the transaction request I'm not sure how well this would work generally.

    Unless I misunderstood what you meant here, in which case let me know

    -- Justin

  6. Jasemin
    Member
    Posted 4 months ago #

    Thanks for your immediate response justin. Yes am telling about the transaction id returning from payment gateway. I have one idea, Advise me if i am wrong. As i said in my previous post i modified some codes and getting transaction id as my order id, but getting previous transaction id. does it means this plugin code is executing before my payment gateway, so that value stored in previous session is coming here. If it is so, can we make it as, payment class executes first and then our plugin. Sorry if i am wrong.

    Thanks
    -Jasemin

  7. SkyVerge
    Member
    Plugin Author

    Posted 4 months ago #

    Yeah I'll admit that's pretty odd that you're getting the previous transaction id set, I can't really imagine how that's happening. See the thing is, like I said, the Order/Order Number is generated *before* the transaction request is made and the response containing the transaction id is received. So to get this working I guess you'd actually have to modify the payment gateway, and update the order record with the transaction id as the order number, after the transaction response is received. Make sense?

    -- Justin

  8. Jasemin
    Member
    Posted 4 months ago #

    Modifying payment class in the sense, You telling to make the payments class execute before order is generated, If its so, actually am passing data to payment gateway by getting it from generated order. If i make payment class before order generation i cant get the order data to pass. ok it seems very complex. let me think in some other way. Thanks a lot for your quick response justin.

    Thanks

  9. SkyVerge
    Member
    Plugin Author

    Posted 4 months ago #

    What I mean is that I think you'd have this sequence of events:

    1. The order is created and a "temporary" order number is generated
    2. The payment gateway transaction request is made
    3. The payment gateway transaction response is received
    4. Some custom code takes the transaction id for the just completed order/transaction, and updates the wp_postmeta record using transaction id in place of the "temporary" order number

    I guess one place you could try to do this is by using the 'woocommerce_payment_complete' action which passes the order id. You'd just need a way to grab the transaction id to use, and this will depend on the particular gateway. All SkyVerge gateways set the transaction id on the post_meta for the order, but this isn't necessarily the case for payment gateways written by other people. Though from the sounds of it you may already know how to grab the transaction id for this gateway. Which gateway is it, by the way?

    -- Justin

  10. Jasemin
    Member
    Posted 4 months ago #

    ok will try in this way, but having one doubt if i update the order number after getting it from payment gateway, will it get updated in all places wherever order id comes(like in My account page in frontend, orders in Admin). Its Braintree Api we are using.

    Thanks

  11. Jasemin
    Member
    Posted 4 months ago #

    Hi justin,
    That works great, I did as you mentioned first storing value temporarily, then updating with transaction id by adding some custom coding.

    Thanks

  12. SkyVerge
    Member
    Plugin Author

    Posted 4 months ago #

    Woot!

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.