Hi there,
You can use Admin API to check product status first.
Use the GET request to fetch product details and check the current status and requires_shipping field:
GET /admin/api/2023-10/products/{product_id}.json
Update Product: If the product’s status is “draft,” you can change it to “active” and set requires_shipping to true in one PUT request:
PUT /admin/api/2023-10/products/{product_id}.json
{
"product": {
"id": {product_id},
"status": "active",
"requires_shipping": true
}
}
Automate on Status Change: You could run this script regularly or use a webhook that triggers when a product is updated to automate the process.
Hope this helps.
Best,
Daniel