Hi, and thanks for trying to make the improvements that you need.
I’m not certain why this isn’t working, but I’m keen to help, adding a reprint button would be much quicker than the current method of using an order action.
My only concern with this code (and I may just not understand the mechanism, I’m really a C++/C# programmer, so PHP is quite new to me), is how the $order_id parameter is passed to the action hook by your reprint($coming_id) function.
Maybe you should call do_action() like this:
do_action('woocommerce_order_action_star_cloudprnt_reprint_action_new', $order_id);
If that doesn’t work then I think you will need to add some logging. Firstly to ensure that the hook is being triggered, an then to see if a valid order id is being passed in to it.
Thank you for your detailed answer. Release plugin is awesome.
Actually, I tried all alternative method as yours but not working. I created new actions and test trigger by change your code but something wrong. Now, I’m thinking change order status like that hold and again processing 🙂 But it will be bad for completed orders.
Do you have a suggest for this example URL? I want to use your action with URL like status action.
wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce_mark_order_status&status='.$status_slug.'&order_id=' . $order->get_id() ), 'woocommerce-mark-order-status' ),
-
This reply was modified 5 years, 10 months ago by
teowork.
I Solved the problem. I was sending $order_id . Yes, It was true for function but trigger wanted $order for other processes.
Worked do_action:
do_action('woocommerce_order_action_star_cloudprnt_reprint_action', $order);
Thank you for opened my mind
-
This reply was modified 5 years, 10 months ago by
teowork.
Great, well done getting it working and thanks for letting me know 🙂
Hi @teowork
Can I kindly ask where you are trying to add your ‘Reprint’ button?
What is your custom dashboard?
All the best