def woocommerce_cupones(): # json = request.get_json() # print(json['registros']) # asd = wcapi.get("products", params={"per_page": json['registros']}).json() # cupones = wcapi.get("coupons", params={"per_page": 100, "id" : 1}).json() cupones = wcapi.get("coupons").json() return jsonify(cupones)
def woocommerce_ordenes(limit): # asd = wcapi.options("orders").json() # asd = wcapi.get("search").json() ordenes = wcapi.get("orders", params={"per_page": limit}).json() # print(ordenes) # print(len(ordenes)) # print(type(ordenes)) return jsonify(ordenes)
def woocommerce_orden_update(id, idolva): getPro = wcapi.get("orders/{}".format(id)).json() for asd in getPro['meta_data']: if (asd['key'] == "_wc_shipment_tracking_items"): asd['value'][0]['tracking_number'] = idolva asd['value'][0]['tracking_provider'] = "Olva" # print(asd['value'][0]['tracking_number']) # print(getPro['meta_data'][6]['value'][0]) # print(getPro['meta_data']) data = { "status": "despachado", "meta_data": getPro['meta_data'] } response = wcapi.put("orders/{}".format(id), data).json() return jsonify(response)
def woocommerce_orden_id(id): asd = wcapi.get("orders/{}".format(id), params={"per_page": 100}).json() return jsonify(asd)
def woocommerce_product_id(id): asd = wcapi.get("products/{}".format(id), params={"per_page": 100}).json() return jsonify(asd)
def woocommerce_product(limit): productos = wcapi.get("products", params={"per_page": limit}).json() # print(productos) # print(len(productos)) # print(type(productos)) return jsonify(productos)