• Resolved quadlayers

    (@quadlayers)


    Hello Mailchimp Team,

    I would like to bring to your attention a critical logic issue we’ve encountered with the Mailchimp for WooCommerce plugin, specifically regarding the cart recovery process.

    The issue arises with certain payment methods, such as Paddle, which generate a new order before the payment is confirmed. Here’s a breakdown of the problem:

    1. Order Creation Before Payment Confirmation: Payment gateways like Paddle create an order as soon as the user initiates the checkout process, even before the payment is completed. This order creation triggers your plugin to send a cart recovery email to the user.
    2. Cart Recovery Email Sent Prematurely: The plugin sends recovery emails based on the assumption that the order has not been completed. However, since an order is technically created (but not yet paid for), the plugin mistakenly sends recovery emails even though an order exists.
    3. Invalid Recovery Cart Links: Once the payment gateway triggers the “order created” hook, the plugin deletes the cart, as it assumes the order is completed. However, this doesn’t stop the previously sent recovery email. As a result, users receive recovery emails with invalid cart links because the cart has already been deleted.

    Proposed Solutions:

    • Remove Recovery Emails for Orders Created: The plugin should call the Mailchimp API to remove any recovery emails queued or sent to users who have created an order, regardless of whether the payment has been completed or not.
    • Prevent Cart Deletion Until Payment Confirmation: Alternatively, the plugin should delay the deletion of the cart until the payment is fully confirmed, ensuring that the recovery email is only sent if the order is genuinely abandoned.

    Implementing either of these solutions should resolve the issue and prevent users from receiving emails with invalid recovery cart links, thereby improving the user experience and reducing confusion.

    Thank you for addressing this matter. We look forward to your prompt resolution.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter quadlayers

    (@quadlayers)

    Proposed solution:

    public function onNewOrder($order_id)
    {
    $order = MailChimp_WooCommerce_HPOS::get_order($order_id);

    public function onNewOrder($order_id)
    {
    $order = MailChimp_WooCommerce_HPOS::get_order($order_id);

    // Check if Mailchimp is configured
    if (!mailchimp_is_configured()) {
    return;
    }

    // FIX: Check if the order is complete before proceeding
    if ($order->get_status() !== 'completed') {
    return;
    }

    // Grab the landing site cookie if we have one here
    $landing_site = $this->getLandingSiteCookie();
    if (empty($landing_site)) {
    $landing_site = $order->get_meta('mailchimp_woocommerce_landing_site');
    if (!$landing_site) $campaign = null;
    }

    // Expire the landing site cookie so we can rinse and repeat tracking
    $this->expireLandingSiteCookie();

    // Remove this record from the database only if the order is complete
    $this->clearCartData();

    return array (
    'landing_site' => $landing_site
    );
    }
    Plugin Author ryanhungate

    (@ryanhungate)

    @quadlayers thanks so much for the detailed issue. This does make sense the way you describe your problem. As of now the cart record does not get deleted when an order status is pending and that’s most likely what the problem is right now. When these orders are created and not paid, is that the status they get left in? If so, there could most certainly be a solution for you:

    We have a hook that gets fired during order transformation that might be of help. Inside this function, if you detect that the original woo order status is pending you might want to do something like this:

    $email_hash = $order->getCustomer()->getId();
    $store_id = mailchimp_get_store_id();
    mailchimp_get_api()->deleteCartByID($store_id, $email_hash);

    Before we put something in the plugin that goes out to a lot of stores, we first try to offer custom solutions to fix problems that might be specific to your use case.

    Do you think something like this would work? To be able to use this custom hook for the order, right before sending it to Mailchimp, but give you the ability to delete the cart from Mailchimp so this doesn’t actually send?

    Plugin Support khungate

    (@khungate)

    Hi @quadlayers, we’re going to close out this ticket for now since it’s been a few weeks since we’ve been in touch.

    Please let us know if you still need any help, have additional thoughts around the proposed solution and we’ll be glad to reopen and troubleshoot further. Please note, that the best way to reach us is over at the GitHub plugin page: https://github.com/mailchimp/mc-woocommerce/. From there, you can receive direct responses from the development team, log new issues, download the latest version, and track existing support tickets.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.