Cover image
Try Now
2025-04-14

Projet d'intégration Shopify

3 years

Works with Finder

0

Github Watches

0

Github Forks

0

Github Stars

Shopify Product Creator

This Python script provides a comprehensive solution for creating products in Shopify using the Admin API. It includes all available parameters and supports features like variants, media, SEO settings, metafields, and more.

Setup

  1. Install the required dependencies:
pip install -r requirements.txt
  1. Set up environment variables:

    Copy the .env.example file to create your own .env file:

    cp .env.example .env
    

    Then edit the .env file with your Shopify credentials:

    SHOPIFY_SHOP_URL=your-store.myshopify.com
    SHOPIFY_ACCESS_TOKEN=your_access_token_here
    

    The script will automatically load these environment variables using python-dotenv.

Usage

The script provides a create_product function that accepts various parameters for creating a product. Here's an example of how to use it:

from main import create_product

# Example product data
product_data = {
    "title": "Example Product",
    "description_html": "<p>A detailed product description</p>",
    "product_type": "Accessories",
    "vendor": "My Brand",
    "handle": "example-product",
    "tags": ["new", "featured"],
    "status": "ACTIVE",
    "seo": {
        "title": "Example Product - My Brand",
        "description": "SEO optimized description"
    },
    "product_options": [
        {
            "name": "Size",
            "values": ["Small", "Medium", "Large"]
        }
    ],
    "variants": [
        {
            "title": "Small",
            "price": "29.99",
            "sku": "PROD-001-S",
            "inventory_quantity": 10
        }
    ],
    "collections": ["gid://shopify/Collection/your-collection-id"],
    "metafields": [
        {
            "namespace": "custom",
            "key": "material",
            "value": "Cotton",
            "type": "single_line_text_field"
        }
    ]
}

# Create the product
result = create_product(
    shop_url=os.getenv("SHOPIFY_SHOP_URL"),
    access_token=os.getenv("SHOPIFY_ACCESS_TOKEN"),
    **product_data
)

Parameters

The create_product function accepts the following parameters:

  • shop_url (required): Your Shopify shop URL (e.g., "your-shop.myshopify.com")
  • access_token (required): Your Shopify Admin API access token
  • title (required): Product title
  • description_html: HTML description of the product
  • product_type: Type/category of the product
  • vendor: Product vendor/brand name
  • handle: URL-friendly product handle
  • tags: List of product tags
  • status: Product status ("ACTIVE" or "DRAFT")
  • seo: Dictionary containing SEO title and description
  • product_options: List of product options (e.g., Size, Color)
  • variants: List of product variants with their details
  • media: List of media items (images, videos) to attach to the product
  • gift_card: Boolean indicating if the product is a gift card
  • requires_selling_plan: Boolean indicating if the product requires a selling plan
  • collections: List of collection IDs to add the product to
  • metafields: List of metafields to attach to the product

Error Handling

The script includes comprehensive error handling for:

  • API authentication issues
  • Product creation failures
  • Variant creation errors
  • Media upload problems
  • Invalid parameter values

Errors are raised with descriptive messages to help identify and resolve issues quickly.

相关推荐

  • av
  • Exécutez sans effort LLM Backends, API, Frontends et Services avec une seule commande.

  • 1Panel-dev
  • 🔥 1Panel fournit une interface Web intuitive et un serveur MCP pour gérer des sites Web, des fichiers, des conteneurs, des bases de données et des LLM sur un serveur Linux.

  • WangRongsheng
  • 🧑‍🚀 全世界最好的 LLM 资料总结 (数据处理、模型训练、模型部署、 O1 模型、 MCP 、小语言模型、视觉语言模型) | Résumé des meilleures ressources LLM du monde.

  • rulego
  • ⛓️RULEGO est un cadre de moteur de règle d'orchestration des composants de nouvelle génération légère, intégrée, intégrée et de nouvelle génération pour GO.

  • sigoden
  • Créez facilement des outils et des agents LLM à l'aide de fonctions Plain Bash / JavaScript / Python.

  • hkr04
  • SDK C ++ MCP (Protocole de contexte modèle léger)

  • RockChinQ
  • 😎简单易用、🧩丰富生态 - 大模型原生即时通信机器人平台 | 适配 QQ / 微信 (企业微信、个人微信) / 飞书 / 钉钉 / Discord / Telegram / Slack 等平台 | 支持 Chatgpt 、 Deepseek 、 Dify 、 Claude 、 GEMINI 、 XAI 、 PPIO 、 OLLAMA 、 LM Studio 、阿里云百炼、火山方舟、 Siliconflow 、 Qwen 、 Moonshot 、 ChatGlm 、 Sillytraven 、 MCP 等 LLM 的机器人 / Agent | Plateforme de bots de messagerie instantanée basés sur LLM, prend en charge Discord, Telegram, WeChat, Lark, Dingtalk, QQ, Slack

  • dmayboroda
  • Rag de conversation sur site avec des conteneurs configurables

  • modelscope
  • Commencez à construire des applications multi-agents LLM, plus facilement.

  • paulwing
  • Un référentiel de test créé à l'aide du service MCP

    Reviews

    2.1 (13)
    Avatar
    user_NfolZgtN
    2025-04-24

    I've been using mcp-shopify from TomShlaim for my online store for a while now, and it has significantly streamlined my operations. The integration was seamless, and the user-friendly interface made managing my products and sales a breeze. Highly recommend for any Shopify users looking to enhance their e-commerce experience!

    Avatar
    user_nHtU6IuW
    2025-04-24

    I've been using mcp-shopify for a few months now, and it has truly revolutionized my Shopify experience. Created by TomShlaim, this tool is both user-friendly and highly efficient. I appreciate the seamless integration and the prompt welcome messages that make navigating through it a breeze. Highly recommend it for anyone looking to enhance their Shopify store management!

    Avatar
    user_jMELXOg5
    2025-04-24

    I recently started using mcp-shopify by TomShlaim, and it's been a game-changer for my online store. The seamless integration with Shopify and its user-friendly interface makes managing my inventory and sales so much easier. Highly recommend it for anyone looking to streamline their e-commerce operations!

    Avatar
    user_Hu2q2XTi
    2025-04-24

    As a loyal user of the mcp-shopify application by TomShlaim, I must say it is a game-changer for Shopify store owners. It's incredibly user-friendly, integrates seamlessly, and boosts productivity. It has significantly improved my store's functionality and customer experience. Highly recommended!

    Avatar
    user_I0iC00aL
    2025-04-24

    As a loyal user of mcp-shopify, I must say it's an outstanding tool authored by TomShlaim. It seamlessly integrates into Shopify, making store management a breeze. The user-friendly interface and comprehensive features save me so much time, allowing me to focus more on my customers. Highly recommend to any Shopify store owner!

    Avatar
    user_SAYFGdd4
    2025-04-24

    As a dedicated user of mcp-shopify developed by TomShlaim, I have found this tool to be incredibly efficient for managing my Shopify store. The integration is seamless, and the user interface is intuitive, making navigation a breeze. It has significantly streamlined my workflow, boosting productivity. Highly recommend for Shopify users!

    Avatar
    user_OvSLxY2v
    2025-04-24

    As an avid user of mcp-shopify by TomShlaim, I must say it is a game-changer for e-commerce enthusiasts. This tool's seamless integration with Shopify has significantly streamlined my store management, enhancing both efficiency and user experience. Highly recommended for anyone looking to optimize their online business!

    Avatar
    user_bc5pwmfO
    2025-04-24

    I recently started using mcp-shopify and it's been a game-changer for my online store. The integration with Shopify is seamless and it offers fantastic customization options. TomShlaim truly did an amazing job with this product. Highly recommend mcp-shopify to anyone looking to enhance their Shopify store!

    Avatar
    user_DdHsBGY7
    2025-04-24

    I've been using mcp-shopify by TomShlaim for a while now, and it's an absolute game-changer. The integration with Shopify is seamless, and it's incredibly user-friendly. Whether you're a beginner or an expert, this tool makes managing your online store a breeze. Highly recommend!

    Avatar
    user_G8ACQIyo
    2025-04-24

    I've been using mcp-shopify by TomShlaim and it's a game changer for my Shopify store! The integration is seamless, and the features offered are exactly what I needed to boost my sales and streamline my operations. Highly recommend this tool to anyone looking to enhance their e-commerce experience!

    Avatar
    user_gkuIqoU9
    2025-04-24

    As a dedicated user of mcp-shopify, I find it truly amazing. This product, created by TomShlaim, makes managing my Shopify store incredibly easy and efficient. The user-friendly interface and robust features streamline my workflow, saving me valuable time. The welcome message also sets the tone for a great experience right from the start. Highly recommended for any Shopify merchant looking to enhance their store management!

    Avatar
    user_Cpf4KBUt
    2025-04-24

    As a dedicated user of mcp-shopify, I can confidently say this tool by TomShlaim has been a game changer for my e-commerce store. It seamlessly integrates with Shopify, making store management effortless. The user-friendly interface and efficient features have significantly boosted my productivity. Highly recommend it to any Shopify store owner!

    Avatar
    user_YHHDnYKt
    2025-04-24

    As a devoted user of mcp-shopify, I can confidently say that this tool created by TomShlaim has revolutionized the way I manage my online store. It's incredibly intuitive and user-friendly, helping streamline my operations significantly. The seamless integration with Shopify ensures that I'm always running efficiently. Highly recommended for any e-commerce business looking to enhance productivity!