Hello,
Today I updated my website to the latest version of XStore and XStore core.
Now I’m having some issues with a custom functions.php code, that I was using to hide one of the payment methods with certain shipping methods.
This piece of code was:
add_filter( 'woocommerce_available_payment_gateways', 'payment_gateways_based_on_chosen_shipping_method' );
function payment_gateways_based_on_chosen_shipping_method( $available_gateways ) {
// Not in backend (admin) and Not in order pay page
if( is_admin() || is_wc_endpoint_url('order-pay') )
return $available_gateways;
// Get chosen shipping methods
$chosen_shipping_methods = (array) WC()->session->get( 'chosen_shipping_methods' );
if ( in_array( 'flexible_shipping_single:28', $chosen_shipping_methods ) )
{
unset( $available_gateways['przelewy24'] );
}
elseif ( in_array( 'flexible_shipping_single:29', $chosen_shipping_methods ) )
{
unset( $available_gateways['przelewy24'] );
}
return $available_gateways;
}
After the update I had to comment it out, because it started giving “internal error” message after trying to pay with this “przelewy24” payment method.
Could you verify it?