• Resolved Kay

    (@kayhagueuniforum)


    Hello

    I have integrated PMP with Woo, followed all instructions as per PMP guides/videos, and Woo settings are spot on I believe.

    However, I cannot for the life of me redirect a guest user to the checkout page after selecting a membership product. They just get redirected to the basket – which is empty.

    This was a problem when I installed Subscriptions for Woo plugin. So I deactivated this, and it worked after adding some code to my functions file, but it’s stopped working and users are just being redirected to an empty basket again!

    The code snippet I used in functions was;

    /*** PMP redirect membership selection to Woo Checkout ***/
    
    add_action('template_redirect','pmpro_woocommerce_redirect_checkout');
    function pmpro_woocommerce_redirect_checkout(){
      $id = get_option('pmpro_checkout_page_id');
      global $post;
      if($post->ID == $id && !empty($_REQUEST['level'])){
        global $wpdb;
        $product_id = $wpdb->get_var($wpdb->prepare("SELECT pm.post_id FROM {$wpdb->postmeta} as pm LEFT JOIN {$wpdb->posts} as p ON p.ID=pm.post_id WHERE pm.meta_key = %s AND pm.meta_value = %d AND p.post_status='publish'",'_membership_product_level',$_REQUEST['level']));
        if(!empty($product_id)){
            $checkout_url = WC()->cart->get_checkout_url();
            if ( sizeof( WC()->cart->get_cart() ) > 0 ) {
              foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) {
                $_product = $values['data'];
                if ( $_product->id == $product_id )
                    $found = true;
              }
              // if product not found, add it
              if ( ! $found )
                WC()->cart->add_to_cart( $product_id );
              wp_redirect( $checkout_url);  
            }else{
              // if no products in cart, add it
              WC()->cart->add_to_cart( $product_id );
              wp_redirect( $checkout_url);  
            }
            exit();
        }
        
      }
    }

    I also have Better Usability for Woo plugin installed which allows me to select from the backend to bypass cart/basket and redirect straight to checkout.

    I simply don’t know what’s happening.

    In addition to this, I have searched all of Google (for days now) to find a clear explanation how to properly setup PMP and Woo integration. The guides just say to not use PMP pages and select Woo pages instead – but what pages should be used for each? Should all be Woo MyAccount? What about Membership confirmation & cancellation page? What about login? I have a custom login page, with PMP login shortcode on it. It provides a link to login or register. When it was possible (in the short time the code/settings worked) to select a membership and proceed to the checkout page (bypassing cart/basket), I was taken to the Woo registration form with the product in the cart and could pay using Woo payments. It created a user and the user details submitted there were displayed within both PMP members details, and Woo user details – Great! But now I cannot register/go to checkout.

    And, if I set the PMP login page to Woo MyAccount with the settings for users to create account on MyAccount page, the logged-out MyAccount page just issues an error for too many redirects, as if Woocommerce is redirecting back to PMP login.

    Urgh!! I’m getting really fed up now with this. It seems like it should be so simple. And it also seems that many PMP users have been asking the same Qs over Google and in this forum, but without any solution, and tickets seem to be closed and marked “resolved” without any answer. If PMP is to integrate with Woo seemlessly, and a user needs to login/register through Woo rather than PMP, why isn’t there clear complete instructions of how to do so?

    At this point, I’m really glad I haven’t yet purchased any additional PMP addons, but it was on my radar to do so once I’m ready to launch cuz I did really like this membership plugin. But my patience is really wearing thin now.

    Please can someone just offer some clear instructions of how to setup PMP to sell memberships through Woocommerce as products, detailing which pages exactly should be selected, how users will login/register fully, whether the PMP membership details need to be shown to users frontend if it’s being purchased through Woo instead, and the rest!

    Thank you, and apologies for this rant, but I’ve been going around and around in circles, and the lack of explanation anywhere is just tiring.

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

    (@kayhagueuniforum)

    Please further note, I have tried to mess around with settings, links, redirects etc this morning again. I added the url link “https://’mydomain’/?add-to-cart=’ID number'” (with correct domain name and product ID) in the custom membership image links, and this worked – sent me directly to the cart with the product added into it – ONCE. It worked ONCE! Then, without changing anything else, it stopped working – just sends me to the homepage with the same url in the browser.

    I really don’t understand what is going on?!

    Please help

    Thread Starter Kay

    (@kayhagueuniforum)

    Hi, further update here –

    I’ve been non-stop trying all morning to get around these issues I’m having. The latest I’ve tried is…

    Have set my login page to have the Woo login/reg form displayed. At least users can create an account now.
    BUT, once a Woo account has been created and the customer has the role of such, PMP blocks their access to the Woo MyAccount page, and just asks them to login (another words, purchase a membership). But they can’t purchase a membership because they just get sent to an empty basket.

    And they can’t login/register using PMP block because, again, they just get sent to an empty basket.

    Oh my days.

    Have hunted high and low for answers to this. Watched PMP’s YT videos, read all the guides, used custom code from elsewhere, tried hooks… Nothing works.

    I’ll be so glad when (if) it finally does, but for now, just purely frustrated.

    Plugin Support Mary Job

    (@mariaojob)

    Hi @kayhagueuniforum,

    However, I cannot for the life of me redirect a guest user to the checkout page after selecting a membership product. They just get redirected to the basket – which is empty.

    Please see the WooCommerce documentation on redirecting to cart here. Redirecting to checkout however may require custom code, I recommend you reach out to the WooCommerce support team for assistance on this.

    On selling memberships as a product via WooCommerce, you can see a link to our documentation on the .org repository here: https://www.ads-software.com/plugins/pmpro-woocommerce/

    Users/Members should be able to access either the Woo Account or PMPro account page. To be able to assist you better, we would need more information. Kindly reach out to us via our contact page on our website: https://www.paidmembershipspro.com/support/

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PMPro & Woocommerce redirects’ is closed to new replies.