• User Newbie

    visualizzazione doppia spedizione

    Ciao a tutti, ho un problema con woocommerce. Ho importato la spedizione nazionale a 5,50 in secondo oggetto a 0 e la spedizione gratis per un ordine di ?40. nel carrello in ogni caso compaioni entrambe e quando spendo piu di 40 non sparisce l'opzione ?5.50. allora ho cercato in rete e ho aggiunto un codice (copio sotto) ma non va , mi appare solo una spedizione, quella gratis per ogni importo. help!!!!
    /**

    • woocommerce_package_rates is a 2.1+ hook
      /
      add_filter( 'woocommerce_package_rates', 'hide_shipping_when_free_is_available', 10, 2 );
      /
      *
    • Hide shipping rates when free shipping is available
    • @param array $rates Array of rates found for the package
    • @param array $package The package array/object being shipped
    • @return array of modified rates
      */
      function hide_shipping_when_free_is_available( $rates, $package ) {
      // Only modify rates if free_shipping is present
      if ( isset( $rates['free_shipping'] ) ) {
      // To unset a single rate/method, do the following. This example unsets flat_rate shipping
      unset( $rates['flat_rate'] );
      // To unset all methods except for free_shipping, do the following
      $free_shipping = $rates['free_shipping'];
      $rates = array();
      $rates['free_shipping'] = $free_shipping;
      }
      return $rates;
      }

  • Bannato Super User

    il codice non funziona più perchè hanno fatto delle modifiche.

    tu cosa vorresti?