• Resolved frencz

    (@frencz)


    Hi, I got this error after last update
    [Tue Mar 05 22:29:13.535156 2019] [proxy_fcgi:error] [pid 2144:tid 140585296041728] [client 162.158.102.140:17658] AH01071: Got error 'strpos(): Empty needle in /opt/bitnami/apps/wordpress/htdocs/wp-includes/plugin.php

    it’s caused by this code:

    
    function my_custom_available_payment_gateways( $gateways ) {
    	$chosen_shipping_rates = WC()->session->get( 'chosen_shipping_methods' );
    	// When 'local delivery' has been chosen as shipping rate
    	if ( in_array('flexible_shipping_11_6', $chosen_shipping_rates )) :
    		// Remove bank transfer payment gateway
    		unset( $gateways['przelewy24'] );
    	endif;
    	return $gateways;
    }	
    add_filter( 'woocommerce_available_payment_gateways', 'my_custom_available_payment_gateways' );
    
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author grola

    (@grola)

    Hi,

    this is custom code from your functions.php?

    What happen after:
    1. this code will be removed/commented?
    2. Flexible Shipping will be deactivated?

    Thread Starter frencz

    (@frencz)

    yes, its custom code from functions.php to limit possibilities of payment options.
    If the code is commented it works fine, if not commented it crash the website or in best case scenario it does not allow to edit menu in appearance section.

    Plugin Author grola

    (@grola)

    Can you change conditions in this code? For example, limit payment options for flat rate, and check if it still fails?

    If still fail please provide us system status from woocommerce.

    Thread Starter frencz

    (@frencz)

    the only thing that changed here is the last update of flexible shpping; after the update this command does not work:
    WC()->session->get( ‘chosen_shipping_methods’ );

    Plugin Author grola

    (@grola)

    Which Woocommerce version?

    Thread Starter frencz

    (@frencz)

    latest one; 3.5.5

    Plugin Author grola

    (@grola)

    W cannot reproduce this problem. The only one we have is: PHP Warning: in_array() expects parameter 2 to be array, null given

    It can be fixed:
    $chosen_shipping_rates = WC()->session->get( 'chosen_shipping_methods', array() );

    ospiotr

    (@ospiotr)

    As we haven’t got any replies, I’m marking this topic as resolved for now.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Website crash after update’ is closed to new replies.