Method: WeChat::REST::Store#stock_update

Defined in:
lib/we_chat/rest/store.rb

#stock_update(product_id, sku_info, original_quantity, new_quantity) ⇒ Object



61
62
63
64
65
66
67
68
69
# File 'lib/we_chat/rest/store.rb', line 61

def stock_update(product_id, sku_info, original_quantity, new_quantity)
  if new_quantity > original_quantity # Adding stock
    stock_add(product_id, sku_info, new_quantity - original_quantity)
  end

  if new_quantity < original_quantity # Reducing stock
    stock_reduce(product_id, sku_info, original_quantity - new_quantity)
  end
end