Sapo Trường Tùy Chỉnh icon

Sapo Trường Tùy Chỉnh

Quản lý trường tùy chỉnh trên Sapo

Biến Thể Sản Phẩm → Cập Nhật

AI-generated

Overview

This node manages custom metafields on product variants in the Sapo e-commerce platform. Specifically, the "Cập Nhật" (Update) operation updates an existing metafield associated with a variant by its ID. This is useful when you want to modify metadata such as inventory details, warehouse locations, or other custom attributes tied to a product variant.

Practical examples include:

  • Updating the storage location of a product variant in your warehouse.
  • Changing custom attribute values like color codes or size specifications stored as metafields.
  • Modifying descriptions or other metadata without altering the main product data.

Properties

Name Meaning
ID Tài Nguyên The numeric ID of the product variant resource whose metafield you want to update.
ID Trường Tùy Chỉnh The numeric ID of the specific metafield to update.
Dữ Liệu Trường Tùy Chỉnh JSON object containing the metafield data to update. It includes fields like namespace, key, value, value_type, and description.

Example of Dữ Liệu Trường Tùy Chỉnh JSON structure:

{
  "namespace": "inventory",
  "key": "warehouse_location",
  "value": "A-12",
  "value_type": "string",
  "description": "Storage location in warehouse"
}

Output

The output is a JSON object representing the updated metafield returned from the Sapo API. It contains all relevant properties of the metafield after the update, such as namespace, key, value, value type, description, and IDs.

Example output snippet:

{
  "id": 12345,
  "namespace": "inventory",
  "key": "warehouse_location",
  "value": "A-12",
  "value_type": "string",
  "description": "Storage location in warehouse",
  "owner_id": 67890,
  "owner_type": "variant"
}

No binary data is produced by this node.

Dependencies

  • Requires an active connection to the Sapo API via an API key credential configured in n8n.
  • The node depends on the internal Sapo API base class for making authenticated requests to manage metafields.
  • Proper permissions on the Sapo account to read and update metafields on product variants are necessary.

Troubleshooting

  • Common issues:

    • Invalid or missing resourceId or metafieldId will cause errors because the node cannot identify which metafield to update.
    • Malformed JSON in the data property can lead to parsing errors or API rejections.
    • Insufficient API permissions may result in authorization errors.
  • Error messages:

    • "Resource not found": Check that the provided variant ID and metafield ID exist.
    • "Invalid JSON data": Verify the JSON structure in the data input property.
    • "Unauthorized" or "Forbidden": Ensure the API key has correct access rights.
  • Resolution tips:

    • Double-check IDs and JSON formatting before running the node.
    • Use the "Get" operation first to confirm the metafield exists.
    • Confirm API credentials and permissions in n8n settings.

Links and References

Discussion