Skip to content

Logged error prevents order placement when quote/order item total is 0. #307

@jhillpolywood

Description

@jhillpolywood

Environment details

PHP version: 8.1
Magento version: 2.4.5-p8
Klaviyo extension version: 4.1.4
Anything else that would help a developer reproduce the bug?

Steps to reproduce

  • In the Magento admin, create a minimal simple product with a price of 0, and save the product
  • Reindex and clear cache
  • As a site visitor or as a Magento administrator, add the simple product as a quote item then attempt to checkout from the storefront or the Magento admin, respectively.
  • In developer mode, the following error is raised:
    Warning: Undefined array key $array in /vendor/klaviyo/magento2-extension/KlaviyoV3Sdk/KlaviyoV3Api.php on line 392
  • In production mode, the order cannot be placed and the error above is logged in var/report

Expected result

Order is placed successfully.

Actual result

The following error is raised:
Warning: Undefined array key $array in /vendor/klaviyo/magento2-extension/KlaviyoV3Sdk/KlaviyoV3Api.php on line 392

Additional information

We patched this in the interim by setting a fallback value of (int)0 for the missing array key reported in the error:

self::VALUE_KEY_PAYLOAD => empty($eventProperties[self::VALUE_KEY_PAYLOAD_OLD]) ? 0 : $eventProperties[self::VALUE_KEY_PAYLOAD_OLD],

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