• Resolved joelmellin

    (@joelmellin)


    Hi!

    I created a custom order status for a certain payment gateway. When such orders are cancelled the stock is not automatically restored as it is with other order statuses.

    Could you fix this?

    I tried a filter:

    add_action( ‘woocommerce_order_status_???_to_cancelled’, array( $this, ‘restore_order_stock’ ), 10, 1 );

    but I don’t know if this is the best solution and I could not get it to work since I don’t know what to write instead of ??? above.

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author tychesoftwares

    (@tychesoftwares)

    Hi @joelmellin,

    Yes, I could replicate this at our end and will have a word with our team on this. I’ll get back to you with an update as to how can we solve this.

    Thread Starter joelmellin

    (@joelmellin)

    Thanks!

    Plugin Author tychesoftwares

    (@tychesoftwares)

    Hi @joelmellin,

    Thank you for your patience. We found the solution for this.

    You can try below filter:

    
    add_action( 'woocommerce_order_status_demo2', 'wc_maybe_increase_stock_levels' );
    add_action( 'woocommerce_order_status_cancelled', 'wc_maybe_increase_stock_levels' );
    

    And in the above hook, you’ll need to replace “demo2” with the slug of your custom order status.

    Do let me know if this helps you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Stock is not restoredwhen order is cancelled’ is closed to new replies.