@frappe.whitelist(allow_guest=True)
def get_product_info(item_code):
 if (not is_cart_enabled()):
  return {}
 qty = 0
 cart_quotation = _get_cart_quotation()
 template_item_code = frappe.db.get_value(u'Item', item_code, u'variant_of')
 in_stock = get_qty_in_stock(item_code, template_item_code)
 price = get_price(item_code, template_item_code, cart_quotation.selling_price_list)
 if price:
  price[u'formatted_price'] = fmt_money(price[u'price_list_rate'], currency=price[u'currency'])
  price[u'currency'] = (((not cint(frappe.db.get_default(u'hide_currency_symbol'))) and (frappe.db.get_value(u'Currency', price.currency, u'symbol') or price.currency)) or u'')
  if (frappe.session.user != u'Guest'):
   item = cart_quotation.get({u'item_code': item_code})
   if item:
    qty = item[0].qty
 return {u'price': price, u'stock': in_stock, u'uom': frappe.db.get_value(u'Item', item_code, u'stock_uom'), u'qty': qty}

@ frappe . whitelist ( allow_guest = True ) def get_product_info ( item_code ) : if ( not is_cart_enabled ( ) ) : return { } qty = 0 cart_quotation = _get_cart_quotation ( ) template_item_code = frappe . db . get_value ( u'Item' , item_code , u'variant_of' ) in_stock = get_qty_in_stock ( item_code , template_item_code ) price = get_price ( item_code , template_item_code , cart_quotation . selling_price_list ) if price : price [ u'formatted_price' ] = fmt_money ( price [ u'price_list_rate' ] , currency = price [ u'currency' ] ) price [ u'currency' ] = ( ( ( not cint ( frappe . db . get_default ( u'hide_currency_symbol' ) ) ) and ( frappe . db . get_value ( u'Currency' , price . currency , u'symbol' ) or price . currency ) ) or u'' ) if ( frappe . session . user != u'Guest' ) : item = cart_quotation . get ( { u'item_code' : item_code } ) if item : qty = item [ 0 ] . qty return { u'price' : price , u'stock' : in_stock , u'uom' : frappe . db . get_value ( u'Item' , item_code , u'stock_uom' ) , u'qty' : qty }
get product price / stock info .