How can I add the “and” or “&” in the snippet?
-
Hi, I would like to know if you someone can help me regarding this code snippet for woocommerce stock translation, because here in italy the number 0 and the numbers <2 are plural, instead the 1 is singular so when there is only 1 left in stock will be “disponibile”, when there are 0 left or <2 will be “disponibili”. The major difference is the last letter change when is singular in “e” and when is plural “i”. Said this, here the code:
`add_filter( ‘woocommerce_get_availability’, ‘custom_get_availability’, 1, 2);function custom_get_availability( $availability, $_product ) {
global $product;
$stock = $product->get_total_stock();
if($stock < 2):
$availability[‘availability’] = __(‘Solo ‘ . $stock . ‘ disponibile’, ‘toolsjet’);
endif;
return $availability;
}
In this case what I can do for being the “if stock 0 and <2” is possible doing in some way?
- The topic ‘How can I add the “and” or “&” in the snippet?’ is closed to new replies.