This topic has 5 replies, 3 voices, and was last updated 9 months, 1 weeks ago ago by Andrew Mitchell
Avrei bisogno di escludere dai metodi di pagamento, il Contrassegno se NON sono in lingua italiano. Ho provato a mettere questo codice ma mi da errore:
add_filter( ‘woocommerce_available_payment_gateways’, ‘payment_gateway_disable_role’ );
function payment_gateway_disable_role( $available_gateways ) {
global $woocommerce;
//trova la modalità di pagamento selezionata
$chosen_methods = WC()->session->get( ‘chosen_shipping_methods’ );
$chosen_shipping = $chosen_methods[0];
//verifica se spedizione nazionale
if ( $chosen_shipping==’local_delivery’ ) {
unset( $available_gateways[‘cod’] ); //in contanti – contrassegno
}
return $available_gateways;
}
Hi @Stefano Valso,
Please with this code instead:
/**
* @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;
}
We’ve checked your checkout page but we couldn’t see any shipping type or COD payment method:
Can you update the codes and check again?
Best Regards,
8Theme’s Team
Ho inserito nel file, il codice e funziona tutto correttamente.
Grazie mille
Hi @Stefano Valso,
In the spirit of gratitude, we want to express our appreciation for your trust in our products. As a valued customer, your experience matters greatly. Would you consider sharing it by giving our theme a deserving 5-star rating on ThemeForest?
Click here to share your thoughts: https://themeforest.net/downloads
Being part of our community means a lot, and your feedback contributes immensely.
Best Regards,
The 8Theme Team
Dear Stefano Valso,
Choosing our theme reflects your commitment to quality, and for that, we’re genuinely grateful. As we constantly strive to elevate your experience, your feedback is an invaluable gift. Could you kindly take a moment to rate our product with 5 stars on ThemeForest?
Click here to share your insights: https://themeforest.net/downloads
Your support fuels our journey, and we appreciate it more than words can express.
Best Regards,
The 8Theme Team
The issue related to '‘Togliere metodo di pagamento (contrassegno) se la lingua non in italiano’' has been successfully resolved, and the topic is now closed for further responses