Skip to content

Instantly share code, notes, and snippets.

@lehelmatyus
Last active June 30, 2016 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lehelmatyus/2a3003a96025e613317f62d0db259630 to your computer and use it in GitHub Desktop.
Save lehelmatyus/2a3003a96025e613317f62d0db259630 to your computer and use it in GitHub Desktop.
Modify WooCommerce In stock text
<?php
function inastheme_get_availability( $availability, $_product ) {
global $product;
$stock = $product->get_total_stock();
if ( $_product->is_in_stock() ) $availability['availability'] = __('Limitierte Edition' . $stock . ' erhältlich', 'woocommerce');
if ( !$_product->is_in_stock() ) $availability['availability'] = __('SOLD OUT', 'woocommerce');
return $availability;
}
add_filter( 'woocommerce_get_availability', 'inastheme_get_availability', 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment