Problem/Motivation

When an Order Item without an purchasable entity is completed in an order (in our case a "Donation" item) Simple Facebook Pixel throws the following error:
Error: Call to a member function getSku() on null in Drupal\simple_facebook_pixel\EventSubscriber\PixelSubscriber->purchaseEvent() (line 215 of modules/contrib/simple_facebook_pixel/src/EventSubscriber/PixelSubscriber.php).

Steps to reproduce

Create an Order Item that has no purchasable entity. Set Simple Facebook Pixel to track Purchase in the admin (/admin/config/system/simple-facebook-pixel). Complete checkout and you will see the error

Proposed resolution

Check for Null case on Order Item Purchased Entity

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

code-brighton created an issue. See original summary.

code-brighton’s picture

StatusFileSize
new1.62 KB

Added patch from merge request

gnikolovski’s picture

Assigned: code-brighton » gnikolovski

gnikolovski’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.