← back to Dw Unbuyable Recovery Pilot
tk11124-dwve-velvet/verify_pub.mjs
11 lines
import { gql } from '../../designerwallcoverings/scripts/lib/shopify.mjs';
// publication check on 2 products (canary + last)
for (const id of ['6621005643827','6621006463027']) {
const d = await gql(`{ product(id:"gid://shopify/Product/${id}"){ title
publishedOnCurrentPublication onlineStoreUrl
resourcePublicationsV2(first:20){ nodes{ isPublished publication{ name } } } } }`);
const p = d.product;
const chans = (p.resourcePublicationsV2?.nodes||[]).filter(n=>n.isPublished).map(n=>n.publication.name);
console.log(`${p.title}: onlineStoreUrl=${p.onlineStoreUrl?'yes':'NO'} published_channels=${chans.length} [${chans.join(', ')}]`);
}