Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

89
Views
Cómo establecer una política/bandera para evitar que un producto se venda cuando está agotado

Soy realmente nuevo en la API de Shopify y estoy trabajando con el código de otra persona. Estoy cargando un producto a través de mi tienda Shopify, pero quiero establecer algún tipo de política en la que un producto no se pueda vender cuando esté agotado, ¿hay alguna manera de que esto se pueda hacer en el código?

Cada vez que creo un producto en Shopify, lo hago así:

 static async createProductInShopify(product) { const createProductsURL = SHOPIFY_URL + '/products.json'; const latestPrice = product.prices[product.prices.length - 1]; const requestBody = { product: { title: product.name, body_html: product.body, vendor: 'My Store', product_type: 'Sample Product', handle: product.handle, tags: product.categories, images: [ { src: product.imageURL } ], variants: [ { option1: product.size ? 'Big' : 'Normal', price: latestPrice, requires_shipping: true, taxable: false, inventory_quantity: product.quantity, inventory_management: 'shopify', inventory_policy: 'continue' } ] } }; const response = await ShopifyController.fetch(createProductsURL, requestBody, 'POST', product); const shopifyJSON = await response.json(); product.productID = `${shopifyJSON.product.id}`; product.productVariantID = `${shopifyJSON.product.variants[0].id}`; product.inventoryLevelID = `${shopifyJSON.product.variants[0].inventory_item_id}`; await product.save(); return product; }

Supongo que la inventory_policy es donde se puede establecer ese indicador, sin embargo, necesito alguna confirmación para ver si eso es cierto.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

sí, la política de inventario para la variante del producto debe establecerse en algo. Estoy compartiendo la captura de pantalla para el valor.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!