Last active
December 5, 2016 11:57
-
-
Save acanza/f5fc328af5e335b86ba5 to your computer and use it in GitHub Desktop.
Mostrar solo Envío Gratuito WooCommerce WC < 2.6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//* Oculta resto de métodos de envío cuando envío gratuito está disponible | |
add_filter( 'woocommerce_package_rates', 'mostrar_solo_envio_gratis', 10, 2 ); | |
function mostrar_solo_envio_gratis( $rates, $package ) { | |
global $woocommerce; | |
if ( isset( $rates[ 'free_shipping' ] ) ) { | |
// Sólo muestra la opción de envío gratuito | |
$free_shipping = $rates[ 'free_shipping' ]; | |
$rates = array(); | |
$rates[ 'free_shipping' ] = $free_shipping; | |
} | |
return $rates; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment