{
  "id": "I4LIlXRgmGxbLLJo",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "(Retail) Price Change Sync",
  "tags": [],
  "nodes": [
    {
      "id": "ad5559dc-ed46-4e01-9727-21846ac50510",
      "name": "Shopify Price Update",
      "type": "n8n-nodes-base.shopifyTrigger",
      "position": [
        -1360,
        224
      ],
      "parameters": {
        "topic": "orders/updated",
        "authentication": "accessToken"
      },
      "credentials": {
        "shopifyAccessTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0f391eb8-4de4-4f90-ae95-4d1e9a204ad5",
      "name": "WooCommerce Price Update",
      "type": "n8n-nodes-base.wooCommerceTrigger",
      "position": [
        -1360,
        16
      ],
      "parameters": {
        "event": "product.updated"
      },
      "credentials": {
        "wooCommerceApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "da680227-5f0a-4b5f-9303-6fac1fb5e77b",
      "name": "Extract Price Data",
      "type": "n8n-nodes-base.set",
      "position": [
        -368,
        144
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ef4694e0-fadc-4251-bc62-89e3d2e220ff",
              "name": "oldPrice",
              "type": "string",
              "value": "={{ $json.oldPrice }}"
            },
            {
              "id": "e985b35c-34af-4ade-9bb5-ea90d4f1e3b1",
              "name": "newPrice",
              "type": "string",
              "value": "={{ $json.newPrice }}"
            },
            {
              "id": "7d9f6b6a-9af4-485c-a2bb-d1657bbfe641",
              "name": "sourceSystem",
              "type": "string",
              "value": "={{ $json.sourceSystem }}"
            },
            {
              "id": "3712633c-58db-4293-af58-b7dab3a8db2f",
              "name": "productId",
              "type": "number",
              "value": "={{ $json.id }}"
            },
            {
              "id": "7a1f7f39-9647-4d51-9f2f-b96e8e822c40",
              "name": "sku",
              "type": "string",
              "value": "={{ $json.sku }}"
            },
            {
              "id": "0ca15bbf-7ecf-40a8-a7c2-bbb35fd7a592",
              "name": "priceChangeThreshold",
              "type": "string",
              "value": "={{ $json.priceChangeThreshold }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "30ac1746-dc3e-48fd-86ba-6e93904f0826",
      "name": "Update WooCommerce Price",
      "type": "n8n-nodes-base.wooCommerce",
      "position": [
        1856,
        48
      ],
      "parameters": {
        "imagesUi": {},
        "resource": "product",
        "operation": "update",
        "productId": "={{ $json.id }}",
        "metadataUi": {},
        "dimensionsUi": {},
        "updateFields": {
          "regularPrice": "={{ $('FormatWooCommerce').item.json.regular_price }}"
        }
      },
      "credentials": {
        "wooCommerceApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3d0cf273-c360-4585-870e-750ac301ab90",
      "name": "Update Shopify Price",
      "type": "n8n-nodes-base.shopify",
      "position": [
        1856,
        240
      ],
      "parameters": {
        "orderId": "={{ $json.id }}",
        "operation": "update",
        "updateFields": {
          "note": "={{ $('FormatShopify').item.json.shopifyPrice }}"
        },
        "authentication": "accessToken"
      },
      "credentials": {
        "shopifyAccessTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "882ee241-6a18-4287-8871-333bcac98c46",
      "name": "Merge Platform Updates",
      "type": "n8n-nodes-base.merge",
      "position": [
        2672,
        144
      ],
      "parameters": {},
      "typeVersion": 3,
      "alwaysOutputData": true
    },
    {
      "id": "2dbf4a8f-c7e5-4760-aa27-ac3667e67035",
      "name": "Log Price Changes",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2896,
        144
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "id",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            },
            {
              "id": "admin_graphql_api_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "admin_graphql_api_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "app_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "app_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "browser_ip",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "browser_ip",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "buyer_accepts_marketing",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "buyer_accepts_marketing",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "cancel_reason",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "cancel_reason",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "cancelled_at",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "cancelled_at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "cart_token",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "cart_token",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "checkout_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "checkout_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "checkout_token",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "checkout_token",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "client_details",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "client_details",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "closed_at",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "closed_at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "confirmation_number",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "confirmation_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "confirmed",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "confirmed",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "created_at",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "created_at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "currency",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "currency",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "current_subtotal_price",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "current_subtotal_price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "current_subtotal_price_set",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "current_subtotal_price_set",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "current_total_additional_fees_set",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "current_total_additional_fees_set",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "current_total_discounts",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "current_total_discounts",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "current_total_discounts_set",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "current_total_discounts_set",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "current_total_duties_set",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "current_total_duties_set",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "current_total_price",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "current_total_price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "current_total_price_set",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "current_total_price_set",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "current_total_tax",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "current_total_tax",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "current_total_tax_set",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "current_total_tax_set",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "customer_locale",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "customer_locale",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "device_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "device_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "discount_codes",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "discount_codes",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "duties_included",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "duties_included",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "estimated_taxes",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "estimated_taxes",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "financial_status",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "financial_status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "fulfillment_status",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "fulfillment_status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "landing_site",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "landing_site",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "landing_site_ref",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "landing_site_ref",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "location_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "location_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "merchant_business_entity_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "merchant_business_entity_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "merchant_of_record_app_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "merchant_of_record_app_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "note",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "note",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "note_attributes",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "note_attributes",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "number",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "order_number",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "order_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "original_total_additional_fees_set",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "original_total_additional_fees_set",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "original_total_duties_set",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "original_total_duties_set",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "payment_gateway_names",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "payment_gateway_names",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "po_number",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "po_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "presentment_currency",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "presentment_currency",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "processed_at",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "processed_at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "reference",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "reference",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "referring_site",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "referring_site",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "source_identifier",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "source_identifier",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "source_name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "source_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "source_url",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "source_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "subtotal_price",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "subtotal_price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "subtotal_price_set",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "subtotal_price_set",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "tags",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "tags",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "tax_exempt",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "tax_exempt",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "tax_lines",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "tax_lines",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "taxes_included",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "taxes_included",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "test",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "test",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "token",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "token",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "total_cash_rounding_payment_adjustment_set",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "total_cash_rounding_payment_adjustment_set",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "total_cash_rounding_refund_adjustment_set",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "total_cash_rounding_refund_adjustment_set",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "total_discounts",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "total_discounts",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "total_discounts_set",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "total_discounts_set",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "total_line_items_price",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "total_line_items_price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "total_line_items_price_set",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "total_line_items_price_set",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "total_outstanding",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "total_outstanding",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "total_price",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "total_price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "total_price_set",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "total_price_set",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "total_shipping_price_set",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "total_shipping_price_set",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "total_tax",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "total_tax",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "total_tax_set",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "total_tax_set",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "total_tip_received",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "total_tip_received",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "total_weight",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "total_weight",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "updated_at",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "updated_at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "user_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "user_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "billing_address",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "billing_address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "customer",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "customer",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "discount_applications",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "discount_applications",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "fulfillments",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "fulfillments",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "line_items",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "line_items",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "payment_terms",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "payment_terms",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "refunds",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "refunds",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "shipping_address",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "shipping_address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "shipping_lines",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "shipping_lines",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [
            "id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "12mLi6AQOgh6ruYoTyTDpMAc3kSw1Z2Q-QdfU8uI1fV4",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/{id}",
          "cachedResultName": "Price_Changes_Log"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "17c4fe0d-4cb2-4912-b4fb-676e7562e9bb",
      "name": "Apply Platform-Specific Rules",
      "type": "n8n-nodes-base.code",
      "position": [
        384,
        160
      ],
      "parameters": {
        "jsCode": "// Apply platform-specific pricing rules\nfor (const item of $input.all()) {\n  const basePrice = item.json.newPrice;\n  const sku = item.json.sku;\n  const productId = item.json.productId;\n  \n  // WooCommerce: Round to 2 decimals, may need tax-inclusive pricing\n  // Apply rounding to nearest .99 for psychological pricing\n  let wooPrice = Math.floor(basePrice) + 0.99;\n  \n  // Shopify: Standard 2 decimal rounding\n  let shopifyPrice = Math.round(basePrice * 100) / 100;\n  \n  // Ensure minimum price thresholds\n  if (wooPrice < 0.99) wooPrice = 0.99;\n  if (shopifyPrice < 1.00) shopifyPrice = 1.00;\n  \n  item.json.wooPrice = wooPrice;\n  item.json.shopifyPrice = shopifyPrice;\n  item.json.sku = sku;\n  item.json.productId = productId;\n}\n\nreturn $input.all();"
      },
      "typeVersion": 2
    },
    {
      "id": "4f881962-29dd-4a63-96b1-cd9b5aa3b965",
      "name": "Get many products",
      "type": "n8n-nodes-base.wooCommerce",
      "position": [
        1616,
        48
      ],
      "parameters": {
        "limit": 1,
        "options": {},
        "operation": "getAll"
      },
      "credentials": {
        "wooCommerceApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ba3fef44-37ad-42e9-8690-279f3b5800e2",
      "name": "Shopify Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        -1040,
        224
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ef4694e0-fadc-4251-bc62-89e3d2e220ff",
              "name": "oldPrice",
              "type": "string",
              "value": "={{ $json.line_items[0].price }}"
            },
            {
              "id": "e985b35c-34af-4ade-9bb5-ea90d4f1e3b1",
              "name": "newPrice",
              "type": "string",
              "value": "={{ $json.current_total_price }}"
            },
            {
              "id": "f6f721d9-8cdd-4a38-9514-301de0bf9b3f",
              "name": "priceChangeThreshold",
              "type": "string",
              "value": "500"
            },
            {
              "id": "7d9f6b6a-9af4-485c-a2bb-d1657bbfe641",
              "name": "sourceSystem",
              "type": "string",
              "value": "shopify"
            },
            {
              "id": "3712633c-58db-4293-af58-b7dab3a8db2f",
              "name": "productId",
              "type": "number",
              "value": "={{ $json.id }}"
            },
            {
              "id": "7a1f7f39-9647-4d51-9f2f-b96e8e822c40",
              "name": "sku",
              "type": "string",
              "value": "={{ $json.line_items[0].title }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "1212189b-77ff-4fe5-b0da-d8f50d7b7eb2",
      "name": "WooCommerce Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        -1040,
        16
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ef4694e0-fadc-4251-bc62-89e3d2e220ff",
              "name": "oldPrice",
              "type": "string",
              "value": "={{ $json.price }}"
            },
            {
              "id": "e985b35c-34af-4ade-9bb5-ea90d4f1e3b1",
              "name": "newPrice",
              "type": "string",
              "value": "={{ $json.regular_price }}"
            },
            {
              "id": "f6f721d9-8cdd-4a38-9514-301de0bf9b3f",
              "name": "priceChangeThreshold",
              "type": "string",
              "value": "150"
            },
            {
              "id": "7d9f6b6a-9af4-485c-a2bb-d1657bbfe641",
              "name": "sourceSystem",
              "type": "string",
              "value": "wooCommerce"
            },
            {
              "id": "3712633c-58db-4293-af58-b7dab3a8db2f",
              "name": "productId",
              "type": "number",
              "value": "={{ $json.id }}"
            },
            {
              "id": "f39aa51d-8f5d-4b75-a8a8-866993b6e657",
              "name": "sku",
              "type": "string",
              "value": "={{ $json.sku }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "df93f4e5-b916-461c-9b66-53d5148f03a5",
      "name": "FormatShopify",
      "type": "n8n-nodes-base.set",
      "position": [
        1392,
        240
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "price",
              "type": "string",
              "value": "={{ $json.shopifyPrice.toFixed(2) }}"
            },
            {
              "id": "id-2",
              "name": "productId",
              "type": "number",
              "value": "={{ $json.productId }}"
            },
            {
              "id": "id-3",
              "name": "sku",
              "type": "string",
              "value": "={{ $json.sku }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "7c86ff52-3d3d-4446-90a6-d4588190e245",
      "name": "Get many orders",
      "type": "n8n-nodes-base.shopify",
      "position": [
        1616,
        240
      ],
      "parameters": {
        "limit": 1,
        "options": {},
        "operation": "getAll",
        "authentication": "accessToken"
      },
      "credentials": {
        "shopifyAccessTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "44c8c64d-a389-4781-b816-9d1df5fc1068",
      "name": "FormatWooCommerce",
      "type": "n8n-nodes-base.set",
      "position": [
        1392,
        48
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "regular_price",
              "type": "string",
              "value": "={{ $json.wooPrice.toFixed(2) }}"
            },
            {
              "id": "id-2",
              "name": "id",
              "type": "number",
              "value": "={{ $json.productId }}"
            },
            {
              "id": "id-3",
              "name": "sku",
              "type": "string",
              "value": "={{ $json.sku }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "c89980ef-86ca-4a6f-861a-d8f871797bdb",
      "name": "Notify Team - Sync Complete",
      "type": "n8n-nodes-base.gmail",
      "position": [
        3120,
        144
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "=Price synchronization has been completed successfully.\n\nSummary:\n- Timestamp: {{ $now.toISO() }}\n- Platforms updated: WooCommerce and Shopify\n- Changes logged to Google Sheets\n\nAll price updates have been applied across platforms.",
        "options": {},
        "subject": "Price Sync Complete - {{ $now.toFormat('yyyy-MM-dd HH:mm') }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "366661dd-2ae1-4974-94bc-f0e14a4de450",
      "name": "Alert Team - Major Price Drop",
      "type": "n8n-nodes-base.gmail",
      "position": [
        144,
        32
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "=A significant price change has been detected:\n\nSKU: {{ $json.sku }}\nProduct ID: {{ $json.productId }}\nOld Price: ${{ $json.oldPrice }}\nNew Price: ${{ $json.newPrice }}\nChange: {{ ((($json.newPrice - $json.oldPrice) / $json.oldPrice) * 100).toFixed(2) }}%\nTimestamp: {{ $json.timestamp }}\n\nPlease review this change.",
        "options": {},
        "subject": "Major Price Drop Alert - SKU: {{ $json.sku }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "0bd9a34b-fbaa-4fc7-bf01-c6f090a3743c",
      "name": "Check Price Change Threshold",
      "type": "n8n-nodes-base.if",
      "position": [
        -144,
        144
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "021eecec-577e-4174-bdce-96cf4750e137",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ $json.oldPrice.toNumber() }}",
              "rightValue": 0
            },
            {
              "id": "ac9c0ba9-d4fd-410c-a207-3af6d4844211",
              "operator": {
                "type": "number",
                "operation": "gte"
              },
              "leftValue": "={{ Math.abs((($json.newPrice.toNumber() - $json.oldPrice.toNumber()) / $json.oldPrice.toNumber()) * 100) }}",
              "rightValue": "={{ $json.priceChangeThreshold.toNumber() }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "6c4bfd70-59ea-4df9-a957-8881967df266",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1568,
        -176
      ],
      "parameters": {
        "color": 7,
        "width": 976,
        "height": 656,
        "content": "## Multi-Platform Price Sync Triggers & Configuration\nThe process begins with either a Shopify or WooCommerce trigger that monitors for order or product updates within your stores. Following the trigger, dedicated Configuration nodes standardize the incoming data by mapping product IDs, SKUs and pricing details while establishing platform-specific thresholds to govern how price changes are synchronized.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "7d1a492d-643b-4f0f-83f2-34ea3845d462",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2240,
        -304
      ],
      "parameters": {
        "width": 496,
        "height": 800,
        "content": "# How It Works\n### This workflow automates the synchronization and optimization of product pricing between Shopify and WooCommerce platforms, ensuring price consistency while applying platform-specific psychological pricing strategies.\n# Setup Steps\n## Trigger\nConfigure the Shopify Price Update trigger node to listen for orders/updated and the WooCommerce Price Update trigger node for product.updated events.\n\n## Connections\nLink credentials for Shopify and WooCommerce as the primary commerce sources, Google Sheets for the Price_Changes_Log and Gmail for automated team notifications.\n\n## Configuration\nDefine your priceChangeThreshold (e.g., 500 for Shopify or 150 for WooCommerce) in the respective configuration nodes to automate when the team receives a \"Major Price Drop\" alert via Gmail.\n\n## Intelligence Sync\nThe system automatically checks if a price change exceeds your set threshold. It then applies platform-specific rules\u2014such as rounding WooCommerce prices to the nearest .99\u2014updates the products across both platforms, logs the transaction in Google Sheets and sends a final sync completion notification."
      },
      "typeVersion": 1
    },
    {
      "id": "7a1c3fe7-50c8-4db6-a660-009d00db7b74",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -496,
        -176
      ],
      "parameters": {
        "color": 7,
        "width": 1376,
        "height": 656,
        "content": "## Price Extraction, Validation & Channel Formatting\nThis segment extracts critical product identifiers and pricing data to calculate the percentage change between old and new values. An automated check compares this change against a set threshold, triggering a Gmail alert for major price drops while simultaneously applying platform-specific logic\u2014such as rounding for psychological pricing on WooCommerce and standard formatting for Shopify\u2014to ensure consistent and accurate pricing across all retail channels.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c64d62f4-f8da-4214-9c15-31d279935eab",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1136,
        -176
      ],
      "parameters": {
        "color": 7,
        "width": 1216,
        "height": 672,
        "content": "## Multi-Platform Formatting and Price Synchronization\nThis phase begins with formatting nodes that structure the pricing data, IDs and SKUs into the specific requirements for Shopify and WooCommerce. This is followed by retrieval steps that fetch the necessary product and order context, ensuring the final update nodes can accurately synchronize the new prices across both e-commerce platforms.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "8051e7bf-f1ca-483b-915c-35abd7874e4f",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2464,
        -176
      ],
      "parameters": {
        "color": 7,
        "width": 896,
        "height": 672,
        "content": "## Final Sync Logging and Notification\nThis final section handles the post-synchronization logic. The Merge Platform Updates node consolidates the results from both WooCommerce and Shopify. This unified data is then recorded in a Google Sheets log (\"Price_Changes_Log\") to maintain a history of all price adjustments. Finally, a Gmail notification is dispatched to the team, providing a timestamped summary to confirm that the entire synchronization process was completed successfully across all platforms.\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "a162c733-9bc0-4516-989f-ea72bd64434e",
  "connections": {
    "FormatShopify": {
      "main": [
        [
          {
            "node": "Get many orders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get many orders": {
      "main": [
        [
          {
            "node": "Update Shopify Price",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "FormatWooCommerce": {
      "main": [
        [
          {
            "node": "Get many products",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get many products": {
      "main": [
        [
          {
            "node": "Update WooCommerce Price",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Price Changes": {
      "main": [
        [
          {
            "node": "Notify Team - Sync Complete",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Price Data": {
      "main": [
        [
          {
            "node": "Check Price Change Threshold",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Shopify Price Update": {
      "main": [
        [
          {
            "node": "Shopify Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Shopify Price": {
      "main": [
        [
          {
            "node": "Merge Platform Updates",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Shopify Configuration": {
      "main": [
        [
          {
            "node": "Extract Price Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Platform Updates": {
      "main": [
        [
          {
            "node": "Log Price Changes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update WooCommerce Price": {
      "main": [
        [
          {
            "node": "Merge Platform Updates",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "WooCommerce Price Update": {
      "main": [
        [
          {
            "node": "WooCommerce Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "WooCommerce Configuration": {
      "main": [
        [
          {
            "node": "Extract Price Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Price Change Threshold": {
      "main": [
        [
          {
            "node": "Alert Team - Major Price Drop",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Apply Platform-Specific Rules",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Alert Team - Major Price Drop": {
      "main": [
        [
          {
            "node": "Apply Platform-Specific Rules",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Apply Platform-Specific Rules": {
      "main": [
        [
          {
            "node": "FormatWooCommerce",
            "type": "main",
            "index": 0
          },
          {
            "node": "FormatShopify",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}