Skip to content

[5.x]: EVENT_AFTER_ORDER_PAID can be re-run #4145

@philipboomy

Description

@philipboomy

What happened?

Description

I am not sure if it's a bug but I thought I would report it just in case.

If I partially refund an order and then adjust the order amount by for example adding a discount adjuster to match the refunded the amount so the order goes into paid status again then this event EVENT_AFTER_ORDER_PAID is triggered again. Is that on purpose? I believe it only happens due to Stripe webhooks as I cannot reproduce locally nor on staging where neither has Stripe webhooks running.

Steps to reproduce

  1. Partial refund a paid order
  2. Add a discount adjuster for the refunded amount so paid status is now "paid" again instead of partial paid.
  3. See that the event EVENT_AFTER_ORDER_PAID is triggered again after the Stripe webhook has been received

Expected behavior

That EVENT_AFTER_ORDER_PAID is only run once as the order was only paid once.

Actual behavior

EVENT_AFTER_ORDER_PAID is triggered again

Craft CMS version

5.8.17

Craft Commerce version

5.4.6

PHP version

No response

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions