This topic has 10 replies, 2 voices, and was last updated 7 months, 3 weeks ago ago by Luca Rossi
Avrei bisogno di escludere dai metodi di pagamento, il Contrassegno se NON sono in lingua italiano e se la spedizione è diversa dall’Italia. Ho provato a mettere questo codice, da voi suggerito qualche giorno fa, ma non funziona correttamente:
/**
* @snippet Disable Payment Gateway For Specific Shipping Method
* @how-to Get CustomizeWoo.com FREE
* @author Rodolfo Melogli
* @testedwith WooCommerce 7
* @community https://businessbloomer.com/club/
*/
add_filter( 'woocommerce_available_payment_gateways', 'bbloomer_gateway_disable_for_shipping_rate' );
function bbloomer_gateway_disable_for_shipping_rate( $available_gateways ) {
if ( ! is_admin() && WC()->session ) {
$chosen_methods = WC()->session->get( 'chosen_shipping_methods' );
$chosen_shipping = $chosen_methods[0];
if ( isset( $available_gateways['cod'] ) && 0 === strpos( $chosen_shipping, 'local_pickup' ) ) {
unset( $available_gateways['cod'] );
}
}
return $available_gateways;
}
Dear Stefano Valso,
We hope this message finds you well.
We have observed that when a country other than Italy is selected, the cash on delivery payment method appears to be concealed, as evidenced by the following screenshot: https://prnt.sc/rhSTqBMP3x05.
Could you kindly clear the cache on your end and verify if the issue persists?
Your prompt attention to this matter would be greatly appreciated.
Best regards,
The 8Theme Team
No, c’è un errore, quando la nazione selezionata è ITALIA, DEVE esserci il metodo di pagamento tramite contrassegno, quando seleziono qualsiasi altro paese, deve nascondersi. Attualmente non funziona, vedo sempre BANK TRANSFER
Dear Stefano Valso,
We kindly request that you review the video we have recorded, which can be found at the following link: https://www.awesomescreenshot.com/video/26227807?key=eea36c0d8944d850092c08f5ac2a19e4
Best regards,
The 8Theme Team
Ok ottimo, scusami ho problemi di caching io… Se volessi togliere anche il bonifico bancario? Con la stessa logica che il bonifico deve essere attivo SOLO in Italia?
Hi @Stefano Valso,
In this case, please update the custom code this:
add_filter( 'woocommerce_available_payment_gateways', 'bbloomer_gateway_disable_for_shipping_rate' );
function bbloomer_gateway_disable_for_shipping_rate( $available_gateways ) {
if ( ! is_admin() && WC()->session ) {
$chosen_methods = WC()->session->get( 'chosen_shipping_methods' );
$chosen_shipping = $chosen_methods[0];
if ( isset( $available_gateways['cod'] ) && 0 === strpos( $chosen_shipping, 'local_pickup' ) ) {
unset( $available_gateways['cod'] );
}
if ( isset( $available_gateways['bacs'] ) && 0 === strpos( $chosen_shipping, 'local_pickup' ) ) {
unset( $available_gateways['bacs'] );
}
}
return $available_gateways;
}
Hope it helps!
Ho appena inserito il codice come scritto ma vedo ancora il bonifico bancario 🙁
Dear Stefano Valso,
We suspect that the issue may be related to the cache. Therefore, we kindly ask for your patience while we allow a few hours to pass for the potential resolution of this matter.
Best regards,
The 8Theme Team
Ok grazie mille
Let us know how it goes!
You must be logged in to reply to this topic.Log in/Sign up