All things Shopify and commerce
Hi,
I'm trying to retrieve the orders that don't have an "exported" tag.
I tried these :
tag!=exported
tags!=exported
tag=-exported
exclude_tag=exported
exclude_tag=-exported
exclude_tags=exported
exclude_tags=-exported
This code printed out all orders, including the one with the "exported" tag:
## testing the endpoint URL excluding tags
import requests
# Set the Shopify API Key and Store URL
API_KEY = "****"
STORE_URL = "https://****.myshopify.com"
# Define the Shopify Orders endpoint and headers
ORDERS_ENDPOINT = f"{STORE_URL}/admin/api/2023-01/orders.json?limit=250&tag!=exported"
headers = {
"Content-Type": "application/json",
"X-Shopify-Access-Token": API_KEY
}
# Retrieve all the orders using Shopify's pagination feature
while ORDERS_ENDPOINT:
response = requests.get(ORDERS_ENDPOINT, headers=headers)
response_json = response.json()
# Check if there are any more pages to retrieve
ORDERS_ENDPOINT = response.links.get("next", {}).get("url")
# Print the order numbers
for order in response_json["orders"]:
print(order["order_number"])
I would appreciate any help, thnx
Solved! Go to the solution
This is an accepted solution.
https://6c9e3a-2.myshopify.com/admin/api/2024-01/orders.json?tag_not=exported
use the api like this... it worked for me... "tag_not"
This is an accepted solution.
https://6c9e3a-2.myshopify.com/admin/api/2024-01/orders.json?tag_not=exported
use the api like this... it worked for me... "tag_not"
Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025