api - Shopify - Client side order Tagging -
as per requirements got, in shopify shop, admin should able search orders customer chosen delivery date. feasible thing find tag orders delivery , filter orders tag. question whether there proper way tag orders customer given delivery date when order created? (i'm not allowed use paid app/plug-in)
there 2 approaches figure out admin orders api, both has issues,
write webhook (for order confirmation event) external server user selected delivery date , call admin order api there tag order - issues it's overhead maintain server tagging order , if since admin api doesn't allow cors feasible? (and since shop owner doesn't want pay paid plugin, maintaining server not practical)
call admin api client-side after order confirmed. tried , works it's expected issue have keep admin api credentials orders , transactions stored in client-side javascript not practice @ all, per knowledge.
it's allowed create additional details order @ client side using cart-attributes, , shown @ admin order's page well, shoify doesn't allow search orders using cart-attributes added order.
i grateful if can suggest solution this.
you can chrome plugin (or complex bookmarklet) no server side requirements. see https://developer.chrome.com/extensions/overview
your api calls following poc scripts. api calls won't search order tags skip , filter note_attribute set via theme's .liquid code. chrome plugin list open orders , display them requested delivery date.
get existing order , update note attribute:
jquery.get('/admin/orders/5803440262.json').then(function(d) { console.log(d.order); var = { id: d.order.id, note_attributes: [{ name: 'test value', value: 'test' }] }; jquery.ajax({ url: '/admin/orders/' + so.id + '.json', type: 'put', data: json.stringify({ order: }), contenttype: 'application/json' }).then(function(d) { console.log(json.stringify(d, null, ' ')); }); });
and reading orders:
jquery.get('/admin/orders.json?limit=250').then(function(d) { var count = 0; d.orders.foreach(function(so) { if (so.tags.indexof('__amazon_pending') != -1) count++; }); console.log(count + ' matching orders'); });
Comments
Post a Comment