Togliere metodo di pagamento (contrassegno) se la lingua non in italiano

This topic has 5 replies, 3 voices, and was last updated 9 months, 1 weeks ago ago by Andrew Mitchell

  • Avatar: Stefano Valso
    Stefano Valso
    Participant
    March 19, 2024 at 12:30

    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;
    }

    Please, contact administrator
    for this information.
    4 Answers
    Avatar: Justin
    Luca Rossi
    Support staff
    March 19, 2024 at 13:14

    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:

    https://prnt.sc/YypnrCwVWuzc

    Can you update the codes and check again?

    Best Regards,
    8Theme’s Team

    Avatar: Stefano Valso
    Stefano Valso
    Participant
    March 19, 2024 at 14:41

    Ho inserito nel file, il codice e funziona tutto correttamente.
    Grazie mille

    Avatar: Justin
    Luca Rossi
    Support staff
    March 19, 2024 at 15:02

    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

    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    March 19, 2024 at 15:06

    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

  • Viewing 5 results - 1 through 5 (of 5 total)

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

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.