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

This topic has 10 replies, 2 voices, and was last updated 7 months, 3 weeks ago ago by Luca Rossi

  • Avatar: Stefano Valso
    Stefano Valso
    Participant
    March 28, 2024 at 08:11

    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;
    }
    
    Please, contact administrator
    for this information.
    9 Answers
    Avatar: Justin
    Luca Rossi
    Support staff
    March 28, 2024 at 10:01

    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

    Avatar: Stefano Valso
    Stefano Valso
    Participant
    March 28, 2024 at 10:06

    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

    Avatar: Justin
    Luca Rossi
    Support staff
    March 28, 2024 at 11:36

    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

    Avatar: Stefano Valso
    Stefano Valso
    Participant
    March 28, 2024 at 11:38

    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?

    Avatar: Justin
    Luca Rossi
    Support staff
    March 28, 2024 at 11:49

    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!

    Avatar: Stefano Valso
    Stefano Valso
    Participant
    March 28, 2024 at 11:52

    Ho appena inserito il codice come scritto ma vedo ancora il bonifico bancario 🙁

    Avatar: Justin
    Luca Rossi
    Support staff
    March 28, 2024 at 12:13

    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

    Avatar: Stefano Valso
    Stefano Valso
    Participant
    March 28, 2024 at 12:14

    Ok grazie mille

    Avatar: Justin
    Luca Rossi
    Support staff
    March 28, 2024 at 12:44

    Let us know how it goes!

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

You must be logged in to reply to this topic.Log in/Sign up

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