Tax lines won't automatically generate in Shopify API order

試著忘記壹切 提交于 2019-12-25 04:00:48

问题


I am posting the following to the Shopify API order endpoint:

    {
  "order": {
    "email": "some@email.com",
    "financial_status": "paid",
    "fulfillment_status": null,
    "send_receipt": true,
    "send_fulfillment_receipt": true,
    "note": "Created by somename",
    "line_items": [
      {
        "variant_id": 21718275463,
        "quantity": 1,
        "price": 99,
        "requires_shipping": true,
        "product_id": 6820646151
      },
      {
        "variant_id": 21717700871,
        "quantity": 1,
        "price": 1000,
        "requires_shipping": true,
        "product_id": 6820646151
      },
      {
        "variant_id": 21717690055,
        "quantity": 1,
        "price": 555,
        "requires_shipping": true,
        "product_id": 6821668807
      }
    ],
    "processing_method": "offsite",
    "shipping_address": {
      "first_name": "Chris",
      "address1": "10101 Musick Road",
      "phone": "9999999999",
      "city": "St. Louis",
      "zip": "63123",
      "province": "MO",
      "country": "United States",
      "last_name": "Becker",
      "name": "Chris Becker",
      "country_code": "US",
      "province_code": "MO"
    },
    "source_name": "somename",
    "taxes_included": false,
    "shipping_lines": [
      {
        "title": "standard",
        "price": 0.00,
        "code": null,
        "source": "brand owner on shopify",
        "carrier_identifier": null,
        "tax_lines": null
      }
    ],
    "tags": "some Order"
  }
}

and receiving a response without tax lines that are filled. I have seen on the shopify forum that the taxlines are supposed to then be automatically calculated and filled by shopify. I tried doing it with a customer as well but that didn't work either.


回答1:


The Orders API will not auto-calculate the taxes but if your app knows how much they are then you can include this data using tax_lines and total_tax:

{
  "order": {
    "line_items": [{
      "title": "Big Brown Bear Boots",
      "price": 74.99,
      "quantity": 3,
      "tax_lines": [{
        "price": 13.50,
        "rate": 0.06,
        "title": "State tax"
      }]
    }],
    "total_tax": 13.50
  }
}


来源:https://stackoverflow.com/questions/37620714/tax-lines-wont-automatically-generate-in-shopify-api-order

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!