| import json | |
| import shopify | |
| def get_product_details(handle): | |
| try: | |
| # Shopify products can be searched by handle using the API | |
| products = shopify.Product.find(handle=handle) | |
| if products: | |
| product = products[0] | |
| return json.dumps({ | |
| "title": product.title, | |
| "handle": product.handle, | |
| "status": product.status, | |
| "product_type": product.product_type | |
| }) | |
| return json.dumps({"error": "Product not found"}) | |
| except Exception as e: | |
| return json.dumps({"error": str(e)}) | |