• Resolved WorkinWP

    (@iguanamom)


    Hi,

    Having a strange issue whereby we only offer BACS payment. When you place the order it directs customer to the Cart page (which says empty). It used to show you the information for making the deposit.

    Oddly, if I do this in the same browser where I’m logged in as admin, it shows fine. If I try it in a different browser or incognito, it never shows that information. You’d think it’s because Guest Checkout isn’t enabled, but it is.

    I have rolled back all plugins that deal with woo including woo itself and it made no difference. I’ve updated from PHP 7.6 to 8.0 and 8.1 makes no difference. I’ve resaved permalinks, I’ve reset all safe options in Woo/Tools several times. We don’t run a cache app. I’ve added Cheque option to payments and that didn’t make a difference. I’ve done a staging site to test in but that won’t help because it works since I’m logged in as an admin. I’ve disabled plugins that deal with Woo and even Wordfence.

    I’ve worked on this and googled it for 5 hours now and have gotten nowhere! Anybody have any ideas here? I can’t really afford to switch themes because it absolutely destroys the entire website. I know this used to work just fine.

    All the endpoints are stated ok (none are blank). I’ve removed all CSS. There’s nothing in Customize/WooCommerce that matters for this. I’ve run a check on the DB all ok. No idea what I’m missing here.

    Thanks for any pointers!!

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter WorkinWP

    (@iguanamom)

    Update:

    I ran across this piece of code, which I added and included ‘guest’, however it didn’t make a difference in showing the final BACS payment page. I did log in as an editor and it showed it but it probably would’ve done it anyway. So it appears the issue lies in the fact that someone has to be logged in to see the final BACS payment page for some reason.

    // Enable BACS payment method for customers, shop managers and administrators

    function bacs_payments( $available_payment_gateways ) {

    $user = wp_get_current_user();

    $allowed_roles = array(‘customer’, ‘administrator’, ‘shop_manager’); if (!array_intersect($allowed_roles, $user->roles )) { if (isset($available_payment_gateways[‘bacs’])) { unset($available_payment_gateways[‘bacs’]); } }

    return $available_payment_gateways; }

    add_filter(‘woocommerce_available_payment_gateways’, ‘bacs_payments’, 90, 1);

    Plugin Support RK a11n

    (@riaanknoetze)

    Hi @iguanamom ,

    I just worked through a test checkout on your site and got the same result. When looking through the network requests, I noticed that the checkout/order-received endpoint generated an HTTP 302 code. This essentially means that the page was found, but it was redirected for some reason. WooCommerce, by default, redirects to the cart page when it detects that the cart is empty on the checkout page.

    This tells us a few things:

    • After the checkout page, WooCommerce does try to reach the next page but is being prevented from doing so.
    • In the process, the cart is cleared.
    • Because the cart is being cleared AND it can’t reach the end-point attached to the checkout page (namely order-received), it redirects back to an empty cart page.

    In terms of what’s causing this, it’s a bit tricky. The most common instances where I’ve seen this are linked to:

    • Redirection plugins
    • Redirection coding snippets
    • Redirect rules at the hosting levels (sometimes in the htaccess files)
    • Template overrides of the cart, checkout or thank-you pages in the theme

    As a start, can you share a copy of your status report found under WooCommerce > Status?

    Sidenote: The reason the custom code you shared above isn’t working, is because WooCommerce doesn’t have a guest role.

    Thanks!

    Thread Starter WorkinWP

    (@iguanamom)

    @riaanknoetze Hey, THANK YOU SO MUCH!!! OMG that was a struggle. You were spot on about the redirects. I went back through the plugins and disabled others I hadn’t before and it ended up being a setting in Yoast SEO under some spot I know I would never have enabled myself that dealt with redirects:

    Remove unregistered URL parametersRemove unregistered URL parameters

    Removes unknown URL parameters via a?301?redirect. E.g.,https://www.example.com/?unknown_parameter=yeswill be redirected tohttps://www.example.comNote that the following commonly-used parameters will not be removed:?gclid,?gtm_debug,?utm_campaign,?utm_content,?utm_medium,?utm_source, and?utm_term.

    After disabling that (a couple of times to be sure) that let me see the BACS order page. Wow. You are a genius! Buy you a coffee (or something a little harder? lol). I probably would never have figured that out. I first went through .htaccess because I knew I had some things in there but even setting it to default made no difference. THANK YOU THANK YOU!!! And thanks also for the fast response here. I truly appreciate you ??

    Plugin Support RK a11n

    (@riaanknoetze)

    Wooohooo! So glad to hear this and thanks for confirming that you managed to locate the troublesome setting ??

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