diff --git a/commerce_nosto_tagging.module b/commerce_nosto_tagging.module
index d7d925f..4344917 100644
--- a/commerce_nosto_tagging.module
+++ b/commerce_nosto_tagging.module
@@ -837,7 +837,18 @@ function _commerce_nosto_tagging_get_commerce_product_image_url($commerce_produc
 function _commerce_nosto_tagging_get_commerce_product_availability($commerce_product) {
   if (module_exists('commerce_stock') && isset($commerce_product->commerce_stock)) {
     $remaining_stock = 0;
-    $out_of_stock = commerce_stock_product_check_out_of_stock($commerce_product->product_id, 1, $remaining_stock);
+    $out_of_stock = FALSE;
+    // Commerce Stock 1.x-branch
+    if (function_exists('commerce_stock_product_check_out_of_stock')) {
+      $out_of_stock = commerce_stock_product_check_out_of_stock($commerce_product->product_id, 1, $remaining_stock);
+    }
+    // Commerce Stock 2.x-branch
+    elseif (function_exists('commerce_stock_check_product_checkout_rule')) {
+      $stock_state = TRUE;
+      $message = NULL;
+      $out_of_stock_status = commerce_stock_check_product_checkout_rule($commerce_product, 1, $stock_state, $message);
+      $out_of_stock = $stock_state;
+    }
     if ($out_of_stock) {
       return COMMERCE_NOSTO_TAGGING_PRODUCT_OUT_OF_STOCK;
     }
