• Resolved theaizen

    (@theaizen)


    I encountered an error at checkout, i.e .: call_user_func_array () expects parameter 1 to be a valid callback, class ‘WC_Amazon_Payments_Advanced’ does not have a method ‘checkout_message’
    With PHP 7.4, even if there is the error, everything still works.
    If I activate PHP 8.0, the page doesn’t work.
    How can this be solved?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support Christian

    (@christian1983)

    Hey @theaizen ,

    Hope you are doing well!

    I just check on my site with PHP8 and I can’t reproduce the issue. Maybe I’m missing something.

    Can you describe how to reproduce and which version od WP and Woo you are using?

    Best,
    Christian

    Thread Starter theaizen

    (@theaizen)

    Hello,
    the WordPress version is 5.9.2 and the WooCommerce version is 6.3.1

    Plugin Support Christian

    (@christian1983)

    Hey @theaizen

    Hope you are doing well!

    can you send us the steps you followed to reproduce the issue?

    Best,
    Christian

    Thread Starter theaizen

    (@theaizen)

    Hello,
    the problem occurs when I open the checkout page

    Plugin Support Christian

    (@christian1983)

    Hey @theaizen ,

    Hope you are doing well!

    try to check the following link conflict test on a Staging site, could be some plugin or even the Theme you are using. We need to isolate the problem first.

    If you can’t find the issue, please contact us at WooCommerce.com > My Account > Support. You may need to create an account before you can access that page.
    Please include a link to this forum thread, so that we can keep track of what’s already been done.
    We will be able to help you further there.

    Best,
    Christian

    Thread Starter theaizen

    (@theaizen)

    Hello,
    I disabled the plugins one by one to identify the conflict.
    The plugin that generates the conflict is “YITH WooCommerce Multi-step Checkout Premium”.
    What can I do? Do you have to fix this problem yourself?
    YITH WooCommerce Multi-step Checkout Premium is one of the most purchased plugins, by the way it is the premium version.

    Plugin Support Christian

    (@christian1983)

    Hey @theaizen ,

    Hope you are doing well!

    unfortunately Amazon Pay doesn’t support that plugin, so you will need to contact YITH Support or find a Developer to fix the issue.

    I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

    Best,
    Christian

    Thread Starter theaizen

    (@theaizen)

    Hello,
    I contacted the developers of the plugin, they told me that in the past they had added this code to fix the problem.

    public function wc_amazon_payments_support() { 
                global $wc_amazon_payments_advanced; 
                if ( ! empty( $wc_amazon_payments_advanced ) && $wc_amazon_payments_advanced instanceof WC_Amazon_Payments_Advanced ) { 
                    remove_action( 
                        'woocommerce_before_checkout_form', 
                        array( 
                            $wc_amazon_payments_advanced, 
                            'checkout_message', 
                        ), 
                        5 
                    ); 
                    add_action( 
                        'yith_woocommerce_checkout_payment', 
                        array( 
                            $wc_amazon_payments_advanced, 
                            'checkout_message', 
                        ), 
                        5 
                    ); 
                } 
            }

    The developers told me that the new versions of Amazon pay applied some changes, including that method only in the “WC_Gateway_Amazon_Payments_Advanced_Legacy” class.
    They ask me to interface with you to figure out the best way to modify the code.

    Plugin Support Diego B

    (@diegobarle)

    Hi, @theaizen

    we can only correct the obvious mistakes in the provided snippet.
    Haven’t tested in order to figure out if it actually resolves the problem since we are not supporting that compatibility.

    Attached a snippet which would actually do, what the developers who wrote it wanted it to do.

    <?php
    if ( ! function_exists( 'wc_amazon_apa_remove_checkout_message' ) ) {
    	add_action( 'wp_loaded', 'wc_amazon_apa_remove_checkout_message', 15 );
    	function wc_amazon_apa_remove_checkout_message() {
    		/* Bail early if amazon payments advanced is not enabled. */
    		if ( ! function_exists( 'wc_apa' ) ) {
    			return;
    		}
    
    		/* Grab the gateway's instance. */
    		$amazon_gateway = wc_apa()->get_gateway();
    
    		/* Remove and add actions as needed. */
    		remove_action( 'woocommerce_before_checkout_form', array( $amazon_gateway, 'checkout_message' ), 5 );
    		add_action( 'yith_woocommerce_checkout_payment', array( $amazon_gateway, 'checkout_message' ), 5 );
    	}
    }
    

    Best,
    Diego

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘WC_Amazon_Payments_Advanced – Checkout – PHP 8’ is closed to new replies.