• Resolved rxunique

    (@rxunique)


    I been going under every leaf and still couldn’t find a solution for so long that this is beyond frustration….

    Issue:
    Cartflows does not work with “Pay” button in my account, aka, the order-pay end point. detail below

    Likely Scenario
    1. we have to manually create an order for a customer, and email either the link or ask them to go in to my account to pay/finalise the order

    2. Or for whatever reason, the order is created but payment failed, so abandoned cart will not catch it, and it will sit in orders in my account waiting for payment

    3. Or whatever reason an order is manually assign status of pending payment

    Failed Attempts and detail response

    We have “global checkout” page designed and setup as global checkout, it works perfectly in normal checkout process with url of
    mydomain.com/global-checkout/

    However

    a. Clicking on “pay” button in actions of order listed under my account will go to default Woo-commerce checkout template with url of
    mydomain.com/checkout/order-pay/[order-id]/?pay_for_order=true&key=[some key]

    b. Frankenstein the url to
    mydomain.com/global-checkout/order-pay/[order-id]/?pay_for_order=true&key=[some key]
    will result in 404

    c. tried all settings available and even searched plugins, found nothing. Even google search will return very few closely related results.

    d. Tried to copy form-pay.php & order-receipt.php from WC template to Cartflows plugin folder, then tried step a & b, still same result as before.

    Although i guess these 2 php need to be announced somewhere within the cartflows codes, just like how you would if coding a custom template instead of plugin. Which kinda defeats the purpose of cartflow checkout template.

    And reverse engineering cartflow to find where to insert some code is kinda beyond my skill set.

    Any help would be much appreciated! It is really to much of my surprise how something this simple yet nobody really did it before and so hard to find a solution….

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support CartFlows Team

    (@cartflows)

    Hello @rxunique !

    Welcome to the CartFlows Support!

    Can you please let me know which payment gateway you are using? Also, does your default Checkout page is selected in the Advanced Tab under WooCommerce -> Settings -> Advanced Tab.

    If all the above setting is in place then I suggest you to open a new support ticket from here & share the staging site’s or live site’s wp-admin details.
    Link to open a support request: https://cartflows.com/support/open-a-ticket/
    So, our developer will get it sorted for you.

    Looking forward to hearing from you.

    Thread Starter rxunique

    (@rxunique)

    Further digging I found following which explain why it didn’t work, seems pretty obvious now.

    But this does help with directions of getting “order-pay” end point to work, fixing the url redirect is not difficult, but I got no ideas how to get “order-pay” to work.

    wp-content/plugins/cartflows/modules/checkout/classes/class-cartflows-checkout-markup.php

    public function global_checkout_template_redirect() {
    
    		if ( ! is_checkout() ) {
    			return;
    		}
    
    		if ( _is_wcf_checkout_type() || _is_wcf_thankyou_type() ) {
    			return;
    		}
    
    		// Return if the key OR Order paramater is found in the URL for certain Payment gateways.
    		if ( isset( $_GET['key'] ) || isset( $_GET['order'] ) ) {
    			return;
    		}
    
    		// redirect only for cartflows checkout pages.
         	$order_pay_endpoint      = get_option( 'woocommerce_checkout_pay_endpoint', 'order-pay' );
    		$order_received_endpoint = get_option( 'woocommerce_checkout_order_received_endpoint', 'order-received' );
    
    		$common = Cartflows_Helper::get_common_settings();
    
    		$global_checkout = $common['global_checkout'];
    		
    		//PC::debug($_SERVER['REQUEST_URI']);
    
    		if (
    			isset( $_SERVER['REQUEST_URI'] ) &&
    			// ignore on order-pay.
    			false === wcf_mb_strpos( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '/' . $order_pay_endpoint . '/' ) &&
    			// ignore on TY page.
    			false === wcf_mb_strpos( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '/' . $order_received_endpoint . '/' ) &&
    			// ignore if order-pay in query param.
    			false === wcf_mb_strpos( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ), $order_pay_endpoint . '=' )
    		) {
    
    			if ( '' !== $global_checkout ) {
    			    
    			    //PC::debug($global_checkout);
    
    				$link = apply_filters( 'cartflows_global_checkout_url', get_permalink( $global_checkout ) );
    				
    				//PC::debug($link);
    
    				if ( ! empty( $link ) ) {
    
    					wp_safe_redirect( $link );
    					die();
    				}
    			}
    		}
    	}
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Order-Pay end point 404 Error with cartflows’ is closed to new replies.