Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if order exists before adding order actions #653

Merged
merged 2 commits into from
Jan 24, 2020
Merged

Conversation

madeincosmos
Copy link
Contributor

Fixes #652.

To reproduce:

  1. Install AutomateWoo
  2. Install Subscriptions
  3. Install AutomateWoo -- Subscriptions Addon
  4. Ensure PP Checkout is active
  5. Create a new Workflow in AutomateWoo
    • Trigger: Subscription Order Paid
    • Subscription Order type: Parent
    • Action: Trigger Order Action
    • Order Action: Generate download permissions
  6. Click "Save" to save the workflow.
  7. With latest master, this triggers a fatal error:
2019-12-20T05:31:57+00:00 CRITICAL Uncaught Error: Call to a member function get_id() on bool in /nas/content/live/seventhrstage/wp-content/plugins/woocommerce-gateway-paypal-express-checkout/includes/class-wc-gateway-ppec-admin-handler.php:44
Stack trace:
#0 /nas/content/live/seventhrstage/wp-includes/class-wp-hook.php(288): WC_Gateway_PPEC_Admin_Handler->add_capture_charge_order_action(Array)
#1 /nas/content/live/seventhrstage/wp-includes/plugin.php(206): WP_Hook->apply_filters(Array, Array)
#2 /nas/content/live/seventhrstage/wp-content/plugins/automatewoo/includes/actions/order-trigger-action.php(31): apply_filters('woocommerce_ord...', Array)
#3 /nas/content/live/seventhrstage/wp-content/plugins/automatewoo/includes/abstracts/action.php(239): AutomateWoo\Action_Order_Trigger_Action->load_fields()
#4 /nas/content/live/seventhrstage/wp-content/plugins/automatewoo/includes/abstracts/action.php(222): AutomateWoo\Action->get_fields()
#5 /nas/content/live/seventhrstage/wp-content/plugins/automatewoo/includes/workflow.php(970): AutomateWoo\Action in /nas/content/live/seventhrstage/wp-content/plugins/woocommerce-gateway-paypal-express-checkout/includes/class-wc-gateway-ppec-admin-handler.php on line 44

Proposed fix resolves this error by checking if order exists for given post id.

@james-allan
Copy link
Contributor

Thanks for the PR @madeincosmos. I've just made a slight coding change to remove an extra whitespace. Other than that this looks good to me.

@james-allan james-allan merged commit 3ae8752 into master Jan 24, 2020
@thenbrent thenbrent deleted the fix/issue-652 branch January 24, 2020 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PayPal Checkout causing fatal error in AutomateWoo
3 participants