Cliente: UrbanRoast · urbanroast.myshopify.com · Sesión dev CULTIVA IA
shopify: command not found en el equipo nuevo. ¿Qué hago?"node -v# Instalar Shopify CLI globalmente npm install -g @shopify/cli@latest # Verificar versión instalada shopify version # Ver todos los comandos disponibles shopify commands # Actualizar en el futuro shopify upgrade
npm config get prefix y añade ese directorio + /bin a tu $PATH.
shopify.app.toml y la extensión de descuento antes de hacer shopify app deploy?"La herramienta correcta es shopify app config validate --json desde la raíz del proyecto. No uses GraphQL validation ni revisión manual campo a campo.
# Validar configuración principal (shopify.app.toml) shopify app config validate --json # Si tienes config con nombre: shopify.app.staging.toml shopify app config validate --json --config staging # Si trabajas desde otro directorio shopify app config validate --json --path ./urbanroast-app
discount-function necesita el scope write_discounts. Añádelo a shopify.extension.toml antes del deploy para evitar rechazos en revisión.
valid: true ✓warning: scope missing ⚠Flujo store auth → store execute. Siempre incluir --store en ambos comandos.
# 1. Autenticar (scope mínimo para lectura de productos) shopify store auth \ --store urbanroast.myshopify.com \ --scopes read_products # 2. Listar productos con sus variantes y SKUs shopify store execute \ --store urbanroast.myshopify.com \ --query '{ products(first: 20) { edges { node { id title handle variants(first: 10) { edges { node { id sku inventoryQuantity }}} }}}}'
| Operación | Scope requerido | Flag adicional |
|---|---|---|
| Leer productos | read_products | — |
| Modificar productos | write_products | — |
| Leer inventario | read_inventory | — |
| Ajustar inventario | write_inventory | --allow-mutations |
ETHIOPIA-YIRGA-250G en Madrid Warehouse a 45 unidades."inventoryItemId por SKU y el locationId por nombre de almacén, luego llamar a inventorySetQuantities.
Paso A — Autenticar con scopes de inventario:
shopify store auth \ --store urbanroast.myshopify.com \ --scopes read_products,read_inventory,write_inventory
Paso B — Resolver inventoryItemId por SKU:
shopify store execute \ --store urbanroast.myshopify.com \ --query '{ productVariants(first: 1, query: "sku:ETHIOPIA-YIRGA-250G") { edges { node { inventoryItem { id } } } }}' # → inventoryItemId: "gid://shopify/InventoryItem/44291823935638" shopify store execute \ --store urbanroast.myshopify.com \ --query '{ locations(first: 10) { edges { node { id name } } }}' # → locationId Madrid Warehouse: "gid://shopify/Location/67392847921"
Paso C — Ajustar a 45 unidades (mutation):
shopify store execute \ --store urbanroast.myshopify.com \ --allow-mutations \ --query 'mutation { inventorySetQuantities(input: { name: "available", quantities: [{ inventoryItemId: "gid://shopify/InventoryItem/44291823935638", locationId: "gid://shopify/Location/67392847921", quantity: 45 }] }) { inventoryAdjustmentGroup { id reason } userErrors { field message } } }'
--allow-mutations en shopify store execute. Las queries de lectura no lo necesitan. Nunca omitas --query ni --store.