/**
  * Validate container against our minimum quantity requirement
  *
  * @param bool $passed
  * @param obj $mnm_stock
  * @param obj $product
  * @return void
  */
 public static function validate_container($passed, $mnm_stock, $product)
 {
     $total_items_in_container = $mnm_stock->get_total_quantity();
     $min_qty = intval(get_post_meta($product->id, '_mnm_container_size', true));
     $max_qty = get_post_meta($product->id, '_mnm_max_container_size', true);
     // if a max quantity exists and is not equal to the min quantity we have a non-fixed container size
     if (false !== $max_qty && $min_qty != intval($max_qty)) {
         $min_qty = $min_qty > 0 ? $min_qty : 1;
         $max_qty = intval($max_qty);
         // validate that an unlimited container is in min/max range & build a specific error message
         if ($max_qty > 0 && $min_qty > 0 && ($total_items_in_container > $max_qty || $total_items_in_container < $min_qty)) {
             $message = $total_items_in_container > $max_qty ? __('You have selected too many items.', 'woocommerce-mix-and-match-min-max-quantities') : __('You have selected too few items.', 'woocommerce-mix-and-match-min-max-quantities');
             $message .= '  ' . sprintf(__('Please choose between %d and %d items for &quot;%s&quot;.', 'woocommerce-mix-and-match-min-max-quantities'), $min_qty, $max_qty, $product->get_title());
             wc_add_notice($message, 'error');
             $passed = false;
         } else {
             if ($min_qty > 0 && $total_items_in_container < $min_qty) {
                 wc_add_notice(sprintf(__('Please choose at least %d items for &quot;%s&quot;.', 'woocommerce-mix-and-match-min-max-quantities'), $min_qty, $product->get_title()), 'error');
                 $passed = false;
             }
         }
     }
     return $passed;
 }
/**
 * Notification options for Low stock
 * @param  obj $product product data
 * 
 * @return void
 */
function wpn_low_stock($product)
{
    global $woocommerce;
    $title = __('Product Low Stock', 'wpn_pushbullet');
    $body = sprintf(__('Product %s %s now has low stock.', 'wpn_pushbullet'), $product->id, $product->get_title());
    $args = array('title' => $title, 'message' => $body);
    wpn_send_notification($args);
}