Tried posting this on nostr, but no good answers yet. Maybe someone here knows... Yo AI and/or coding / Woocommerce wizards. I'm setting up a website on Woocommerce. Digital products are "completed" automatically on payment. That's fine, that's how it should be. But I also have the "Product Add-Ons for WooCommerce" plugin installed, I need the order status to remain in "Processing" in case an add-on is added to the product. I've tried ChatGPT and Claude.AI (both free versions) for solutions, I've tried exactly 5 iterations of ChatGPT + 2 iterations of Claude "solutions" - none of them work. Obviously I've also tried finding another plugin that would allow for me to change the order status flow, but haven't found anything applicable. Any ideas/solutions? Are paid versions of ChatGPT, Claude AI or anything else any better at coding? DISCLAIMER: I don't know anything about coding myself. A solution / good suggestions get zapped (obviously). 🤠
In case anybody has the same problem/question and you happen to come across this post: I contacted Woo support regarding the question and asked whether Woocommerce Order Status Control plugin would enable me to do what I described. After receiving a useless AI-genereted answer and asking for a human to answer me (and waiting for a day), I actually got a solution from the support:
  1. Install Code Snippets plugin if you haven't: https://wordpress.org/plugins/code-snippets/
  2. Copy/paste this code into the .PHP section:
add_filter( 'woocommerce_payment_complete_order_status', 'wc_set_addon_orders_to_processing', 10, 3 ); function wc_set_addon_orders_to_processing( $status, $order_id = 0, $order = false ) { if ( 'completed' !== $status ) { return $status; } if ( ! $order && ! $order_id ) { return $status; } $order = $order ? $order : wc_get_order( $order_id ); if ( $order ) { $items = $order->get_items(); foreach ( $items as $item ) { if ( ! empty( $item->get_meta( '_pao_ids' ) ) ) { $status = 'processing'; break; } } } return $status; }
Seems to be working for me!
reply