• Resolved harleec

    (@harleec)


    Without making any changes to my site, the checkout page is misbehaving all of a sudden. A customer will click “Place Order,” after a few seconds, the charge goes through, but the page scrolls to the top to show an error. A very thin reddish line appears, but there’s no error message. The customer then thinks the order wasn’t placed, and clicks the “Place Order” but again, which creates a duplicate order. I’ve looked at the logs, and can’t find any error messages. PLEASE HELP! Is this a common issue with Square, or the plugin?

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi @harleec – Sorry to hear you’re running into this issue on your site.

    It sounds like your site is trying to display a notification of some kind, but something is blocking it. If an order is being created when the customer clicks “Place Order,” it also sounds like there may be some issue with your site’s redirect to the order confirmation page.

    This kind of problem is usually caused by either a conflict with your theme or with another plugin.
    ?
    The best way to determine this is to:
    ?

    • Temporarily switch your theme to Storefront
    • Disable all plugins except for WooCommerce & Square
    • Place a test order

    If you’re not seeing the same problem after completing the conflict test, then you know the problem was with the plugins and/or theme you deactivated. To figure out which plugin is causing the problem, reactivate your other plugins one by one, testing after each, until you find the one causing conflict. You can find a more detailed explanation on how to do a conflict test here.

    I had a similar issue on a site I built for a client, which was not showing any confirmation to the user when they placed an order, leading to duplicate orders. I had to write a script in my themes functions.php in order to get the redirect working correctly. It is a Divi child theme, but the script should work with any theme. I’d be happy to share the script and the procedure to implement it once I return home from my commute (on a train right now). It is strange though that this behavior started all of a sudden. There were no updates to your theme or any dependent plugins?

    Thread Starter harleec

    (@harleec)

    Thanks for the replies. Today, the duplicate orders are not happening, but the WordPress admin responsiveness is extremely slow. For example, it’s taking 5-10 seconds to get into the orders screen, We’re going to reach-out to Namecheap and see if there’s something going on in our backend.

    Hi @harleec – Reaching out to your host definitely sounds like the next best step here. Let us know if you aren’t able to get this resolved on that end!

    Thread Starter harleec

    (@harleec)

    Hi @jlundie – it seems that no one can explain what happened, and we’re still running fine after the weird weekend. We can close the ticket for now.

    Thread Starter harleec

    (@harleec)

    Closing ticket.

    In case anyone else experiences timeout issues in the future and customers aren’t getting directed to any kind of thank you message, here is something you can try to get it working. It involves using a child theme (or a custom theme if you’ve built one from scratch) which I won’t cover here, there’s plenty of documentation on creating a child theme out there.

    1. Create a thank you page, like you would any other page in WordPress

    2. In your theme’s functions.php file, add WooCommerce support:

    /**
     * Declare WooCommerce Support
     *
     */
    function mytheme_add_woocommerce_support() {
    	add_theme_support( 'woocommerce' );
    }
    add_action( 'after_setup_theme', 'mytheme_add_woocommerce_support' );

    3. In your theme’s functions.php file, add the redirect code and alter the URL to direct to your new thank you page:

    /**
     * Custom redirect for order confirmation
     *
     */
    function my_custom_redirect( $order_id ){
        $order = wc_get_order( $order_id );
        $url = 'https://yoursite.com/thank-you';
        if ( ! $order->has_status( 'failed' ) ) {
            wp_safe_redirect( $url );
            exit;
        }
    }
    add_action( 'woocommerce_thankyou', 'my_custom_redirect'); 

    4. Save the functions.php file and upload to your child themes root folder. Or do the code edits directly in WordPress theme editor (Appearance -> Theme Editor -> Theme Files -> functions.php)

    5. (OPTIONAL) Going back to the thank you page you created in the first step, you can add the following short code in addition to whatever thank you message you have, in order to display the order details to the customer: [confirmation_order_details]

    That’s it. This is pretty much the only solution I could find for intermittent timeout issues that kept happening to me. Hope it might help someone else in the future.

    Thanks for the update, @harleec. I’ll mark this thread as resolved. If you run into issues again, feel free to open a new thread!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Charge goes through, but stays on checkout page’ is closed to new replies.