Guides and Examples
...
Price and Discount Tags
Publishing Price Tags
9 min
nue's approach to self service price tags creates an additional layer on top of your existing pricing rules source of truth your main price tag catalog in nue remains the single source of truth selective publishing only explicitly published price tags are available in self service stability published price tags remain consistent until republished, even if the source price tag changes this publishing mechanism provides several benefits for self service implementations protects self service customers from unexpected pricing changes allows testing of pricing rules before making them available to self service provides a clean separation between direct sales and self service pricing ensures pricing consistency for ongoing transactions publishing workflow for self service to make price tags available through the self service api, follow this process create and publish price tags navigate to price builder ā price tags create or edit your price tag with appropriate tiers and rules set the price tag status to 'active' click the edit icon on your price tag make any desired edits click 'publish' to make it available for self service confirm by clicking 'yes' only price tags that are both active and explicitly published will appear in self service api responses checking publication status via api once you understand the publishing workflow, you'll want to programmatically verify publication status and filter price tags based on their availability verify price tag publication status try it now fetch price tags api ā https //api docs nue io/fetch price tag const myheaders = new headers(); myheaders append("nue api key", "your api key here"); myheaders append("content type", "application/json"); async function checkpricetagpublicationstatus() { const response = await fetch("https //api nue io/catalog/price tags", { method 'get', headers myheaders }); const pricetags = await response json(); // analyze publication status const publicationreport = { published \[], totalpricetags pricetags length, bytype { quantity { active 0, total 0 }, term { active 0, total 0 } }, timelimited \[], permanent \[] }; pricetags foreach(pricetag => { const statusinfo = { id pricetag id, name pricetag name, code pricetag code, type pricetag pricetagtype, pricetype pricetag pricetype, active pricetag active, publishstatus pricetag publishstatus, starttime pricetag starttime, endtime pricetag endtime, tiercount pricetag pricetiers? length || 0 }; // all returned price tags are published publicationreport published push(statusinfo); // categorize by type if (pricetag pricetagtype === 'quantity') { publicationreport bytype quantity total++; if (pricetag active) publicationreport bytype quantity active++; } else if (pricetag pricetagtype === 'term') { publicationreport bytype term total++; if (pricetag active) publicationreport bytype term active++; } // categorize by time limitations if (pricetag endtime) { publicationreport timelimited push(statusinfo); } else { publicationreport permanent push(statusinfo); } }); return publicationreport; } // usage checkpricetagpublicationstatus() then(report => { console log('š price tag publication status report'); console log(`total published price tags ${report totalpricetags}`); console log('\nš by type '); console log(` quantity based ${report bytype quantity active}/${report bytype quantity total} active`); console log(` term based ${report bytype term active}/${report bytype term total} active`); console log(`\nā° time limited ${report timelimited length} price tags`); console log(`š permanent ${report permanent length} price tags`); console log('\nā
published price tags '); report published foreach(pricetag => { const status = pricetag active ? 'š¢ active' 'š“ inactive'; const timeinfo = pricetag endtime ? `(expires ${pricetag endtime})` '(permanent)'; console log(` ⢠${pricetag name} (${pricetag code}) ${status} ${timeinfo}`); console log(` type ${pricetag type} ${pricetag pricetype}, tiers ${pricetag tiercount}`); }); }); understanding price tag publication states publication status fields when working with price tags, you'll encounter these key status fields field values description active true , false whether the price tag is currently active and can be applied publishstatus "published" publication status (only "published" tags appear in api) starttime datetime or null when the price tag becomes effective endtime datetime or null when the price tag expires (null = permanent) price tag lifecycle states draft price tag exists but not published (not visible in self service api) published & future published but starttime is in the future published & active published and currently effective published & expired published but endtime has passed unpublished was published but removed from self service integration with order processing published price tags automatically become available for use in order processing if they are set at the price book entry or product option level price tags can also be defined based on the draft order creation payload, like shown below // price tags are automatically considered during order pricing const orderdata = { "customer" { "id" "customer uuid" }, "orderproducts" \[{ "pricebookentryid" "01uea00000f9jpqiav", "quantity" 50, "pricetagid" \["01uea00000f9vptial", "01uea00000f9vptaal"], "pricetagcodes" \["10percentoff", "falldiscount"] }] }; next steps now that you understand price tag publication monitor publication status regularly check which price tags are published plan promotional campaigns use time limited price tags for marketing optimize pricing strategy analyze which price tags drive the most value automate management build monitoring for expiring or problematic price tags the publishing layer gives you complete control over what pricing rules are available in self service while maintaining the flexibility to make changes without disrupting customer experiences