• Resolved meestergijs

    (@meestergijs)


    Hello,

    I have a major issue with my checkout. The normal flow is that members have registered at /aanmelden and then go to /winkel to select a product and at /checkout after choosing a payment method it redirects to the bank payment page/paypal/etc. After completing payment it redirects to the available courses. But currently, when a visitor chooses a payment method and wants to pay it immediately redirects to the restricted content without actually having paid. And even worse, they do get the orde-complete email from woocommerce.

    Here’s the video of what I don’t want: https://screencast-o-matic.com/watch/cYerj4yQ30

    Wat can I do?

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

Viewing 11 replies - 1 through 11 (of 11 total)
  • Hi

    Please follow below steps:

        Go to: WooCommerce > Settings > Products > Downloadable Products.
        Choose a level of Access Restriction.

      – Tick the Downloads Require Login checkbox.
      – Tick the Grant access to downloadable products after payment checkbox.

    I’m from Iran and unfortunately can’t test paypal but redirected to paypal.

    Good Luck

    Thread Starter meestergijs

    (@meestergijs)

    THanks, but it’s already ticked. Could you explain in more detail what this option does?

    Absolutely

    If this option is not checked, the users will have access to product’s files before payment is complete.
    In fact, user just need to click the Place order button, and permissions creates for him/her;

    I suggest you downgrade Woocommerce to the previous version and wait for the Woocommerce team’s response through this thread.

    Good luck

    Thread Starter meestergijs

    (@meestergijs)

    I just found out what the issue was. This bit of code. It should help me empty my cart. But it did so much more.

    add_action( ‘woocommerce_checkout_order_processed’, ‘order_received_empty_cart_action’, 10, 1 );
    function order_received_empty_cart_action( $order_id ){
    WC()->cart->empty_cart();
    }

    ??

    This code just empty cart after payment complete.

    You’re sure?

    Thread Starter meestergijs

    (@meestergijs)

    I know. But it really did have that effect. Isn’t that weird? After deleting just this bit of code, issue was resolved. What can I tell you..

    Yes, that’s right

    This hook is fired just after saving the order not after payment complete.

    You need to replace with this code:

    add_action( 'woocommerce_order_status_completed', 'order_received_empty_cart_action', 10, 1 );
    function order_received_empty_cart_action( $order_id ){
        WC()->cart->empty_cart();
    }
    Thread Starter meestergijs

    (@meestergijs)

    Sorry, that’s the same code..
    I want the cart to be empty after payment has been succesful.

    Hi

    I’m sorry
    I don’t know how PayPal works
    But if you have a Thank you page you can use the following code:

    add_action( 'woocommerce_thankyou', 'ywp_empty_cart', 4 );
    function ywp_empty_cart( $order_id ) {
     
     	$order = wc_get_order( $order_id );
    
            if ( $order->get_status() == 'completed' )
                    WC()->cart->empty_cart();
     
    }

    Good luck

    Thread Starter meestergijs

    (@meestergijs)

    That first code you gave was different. I didn’t see it at first. I think it worked. Thanks!

    You’re welcome.

    Good luck

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Checkout skips payment but grands access to content’ is closed to new replies.