Bright Isn’t Processing My WooCommerce Orders

So the manageOrder() part of bright, is added to woocommerce via the hook:

woocommerce_payment_complete

Specifically, we hook onto it as such:

add_action('woocommerce_payment_complete',function($order_id) {
  $order = wc_get_order($order_id);

  BrightWoocommerceIntegration::manageOrderCallback($order);
}, 10, 1);

This is exactly the same function that is called if you select "Manage Order With Bright" from the Order.

Next step is to verify that this WooCommerce action is being called. A way to do that would to add a hook to your theme's functions.php like:

add_action('woocommerce_payment_complete', function($order_id) {
  $file_path = '/tmp/woocommerce_order_ids.log';
  $content = "Order ID: " . $order_id . " completed at " . date('Y-m-d H:i:s') . PHP_EOL;
  file_put_contents($file_path, $content, FILE_APPEND | LOCK_EX);
}, 10, 1);

and then to verify that the hook is called when the payment is processed.

Here's an example shared by a customer which integrated a payment gateway that didn't post the payment complete action

add_action('woocommerce_before_thankyou',function($order_id) {
  $order = wc_get_order($order_id);
  if ($order->get_payment_method() == 'other_payment') {
        BrightWoocommerceIntegration::manageOrderCallback($order);
  }
}, 10, 1);

You should only use something like this if you aren't able to process payment completion states natively .