Fix fatal in WC notifications when an order item's product is deleted#85
Fix fatal in WC notifications when an order item's product is deleted#85akzmoudud wants to merge 3 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Lets listeners on the existing texty_notification_recipients filter look up the customer the SMS is destined for without reaching into the order themselves. Returns 0 for guest orders so callers can short-circuit identity-required gates (e.g. texty-pro's consent module) without extra null checks. Pure data accessor — no behavior change in the send path.
closes: https://github.com/getdokan/texty-pro/issues/25
Summary
WC_Order_Item_Product::get_product()returningfalseinNotifications\WC\Base::get_items(). Previously, callingget_name()on thefalsereturn fataled and brought down whatever request triggered the send (admin order screen, status change, REST call).{items}token still renders for the surviving products and the notification goes out.Root cause
get_product()returnsfalsewhen the linked product has been permanently deleted. The old code dereferenced it directly: