Skip to content

Klaviyo intermittently breaks checkout #352

@adamlavery

Description

@adamlavery

Environment details

PHP version: 8.1
Magento version: 2.4.6
Klaviyo extension version: 4.2.0
BSS One Step Checkout: 2.3.9

Steps to reproduce

  1. Flush the Magento cache (admin, cache management)
  2. Open an incognito/private browser tab (to ensure no local cache)
  3. Add a product to cart (can be any)
  4. Go to checkout - no email field, place order does nothing.
  5. Refresh and email is there; order can be placed once entered.

Expected result

Email field appears reliably

Actual result

Email field is not there, can't place order.

Additional information

Every time this happens, the following is logged in console:

Image
    bindEmailListener: function () {
      // jquery overrides this, so let's create an instance of the parent
      var self = this;
      console.log('Klaviyo_Reclaim - Binding to #customer-email');
      jQuery('#maincontent').delegate('#customer-email', 'change', function (event) {
        if (!self.isKlaviyoActive()) {
          return;
        }

        self._email = jQuery(this).val();
        if (!window.klaviyo.isIdentified()) {
          window.klaviyo.push(['identify', {
            '$email': self._email
          }]);
        }
        self.postUserEmail(self._email);
      });
    },

Disable Kalviyo integration and the issue goes. Once the checkout is cached, that code never runs (no console log) and the issue does not occur.

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