Shopify Product API Guide: Create, Update, & Delete Products Using Shopify API

Ready to revolutionize your storefront? Discover the power of Shopify Product API: Master creating, updating, and deleting products effortlessly.

Adeel Qayum writer profile picture
By Adeel Qayum
Joel Taylor
Edited by Joel Taylor

Updated March 27, 2024.

A yellow toy forklift with blocks spelling 'APR'

The Shopify API, or application programming interface, is a set of tools and protocols connecting Shopify to various other applications, services, and websites. This allows developers to read, create, update, and delete different data types, including products, orders, customers, and inventory. In this Shopify product API guide, we'll look at:

  • Creating products with Shopify API
  • Adding and updating product information
  • Deleting products via Shopify API
  • Using Simple Sample Data for testing and development
  • Best practices and tips for using Shopify product API


Laying the Foundation for Shopify Product API Success

Before you get started, it's imperative to set up your access to the Shopify API. Here's how:

  1. Navigate to your Shopify admin panel and click on Apps.
  2. Select Manage private apps and create a new private app by specifying a name and email.
  3. Define the required permissions, focusing on product-related actions.
  4. Once created, Shopify generates essential API keys (API key, password, shared secret) that secure your interactions with the API.

» Discover the Shopify app that can assist in producing sample data

1. Creating Products With Shopify API

Once you're all set up, follow these steps to construct API requests to create new products:

1. Choose the appropriate API endpoint

POST /admin/api/2023-07/products.json

2. Set headers for authentication. Include:

"Content-Type: application/json" and "X-Shopify-Access-Token: {access_token}"

3. Create a JSON payload: Shape a product object with details such as title, description, price, and variants.

4. Send the request. Issue a POST request to the chosen endpoint and attach the payload.

5. Handle the API response. Make sure products were created accurately by checking for things like error messages and confirmations.

2. Adding and Updating Product Information

1. To access product data via the Shopify API, issue a GET request to the product endpoint:

https://{store_name}.myshopify.com/admin/api/2023-07/products.json

Extract details like titles, descriptions, prices, and variants from the response.

2. Use PUT or PATCH requests to specific product endpoints to update product information. Make a request payload containing the changes you want, and include it in your API call.

  • For attributes (title, description, pricing), modify the respective fields in your payload.
  • To handle variants and options, annotate variant details in the product payload's variants field.
  • For metadata and custom fields, check the metafields endpoint. Employ POST, PUT, or PATCH requests for creation or updates.

3. Now, let's put this into a real-world context. For example, to update a product's title, send a PUT request to:

products/{product_id}.json

Accompany the request with a payload bearing the new title. For price changes, engage a PATCH request to refresh variant prices.

4. Use the Bulk Operations API to modify multiple products simultaneously for bulk updates. To consistently synchronize your data, use proper error handling and retries.

» Learn more about how to merge products in Shopify 

3. Deleting Products via Shopify API

Pro tip: Before you use the Shopify API to delete products, understand the implications and considerations involved. Removing a product impacts several things, like inventory, orders, and customer experiences.

1. To remove products, send a DELETE request to the specific product endpoint, for example:

https://{store_name}.myshopify.com/admin/api/2023-07/products/{product_id}.json

Confirm by including a query parameter:

?confirm=1

2. You'll want to ensure you're handling associated data appropriately. Prioritize inventory adjustments using the Inventory API. For orders, update linked items or transactions. When you manage these connections, you can better help prevent disruptions in order history and customer records.

4. Here are a few tips to prevent accidental deletions:

  • Use a sandbox environment: Make a test or development store to practice deletions before changing your live store.
  • Implement confirmation steps: Add extra steps or user authentication layers to reduce risk.
  • Backup data: Regularly back up your store data so you can restore any unintended deletions.
  • Keep audit trails: Maintain comprehensive logs of product deletions, which can help identify and resolve errors.

Using Simple Sample Data for Testing and Development

Simple Sample Data can help you test and develop Shopify product API by generating dummy data. By populating your store with test products, collections, orders, and customers, you can validate API interactions before engaging your real data.

  • Choose from three full themes to thoroughly test the API
  • Generate and delete sample data with a single click
  • Pick and choose which sample data you want to test

This way, dummy data benefits you by helping you avoid potential pitfalls in a live environment while accelerating the development process and enhancing overall product quality.



Best Practices and Tips for Using Shopify Product API

  • Performance optimization and rate limiting: Balance request frequency to prevent exceeding API call limits. This can help make sure your operations are consistent and efficient.
  • Effective error handling: Interpret status codes to diagnose issues, which will help you debug swiftly and precisely.
  • Rigorously test API calls: This ensures your product management system is resilient while ironing out flaws and fine-tuning functionalities.
  • Be adaptable: Stay vigilant by tracking API changes and version updates. Prioritize proper versioning in your codebase to stay in line with evolving features and safeguard against potential disruptions.

Streamline Shopify Management With Product API Integration

Using the Shopify Product API gives you access to multiple tools and strategies for better, more efficient product management in your Shopify store. You'll have streamlined creation, updates, and deletions, plus robust integration possibilities and unparalleled customization. As a developer or business owner, leverage Shopify API's potential to enhance your product management workflows.


Don't Know what Shopify is?

Start your own online eCommerce business using Shopify platform. Shopify gives you all the tools needed to make the journey easier, faster and more profitable.

Frequent Releases

We work tirelessly to deliver more value to your business. Our roadmap is largely based on the questions you ask. We listen and we deliver as often as we can.

24/7/365 apps support

You can reach out to us via a dedicated support icon in the apps. We're always there. Or simply send us an email with your questions at support@egnition.io

Pin It on Pinterest