admin管理员组

文章数量:1125004

Can i use "fee_lines" for below 'booking fee' and 'waiter tip' in rest API of woocommerce ? If yes then send here example please.

I used like below but not working.

    "fee_lines": [
    {
      "name": "7.5% Booking Fee",
"tax_status" : 'taxable',
      "tax_class": 0,
      "total_tax": "77.25",
      "total": "77.25",
      "taxes": [],
      "meta_data":  [] 
    },
  {
      "name": "Waiter Tip (5%)",
"tax_status" : 'taxable',
      "tax_class": 0,
      "total_tax": "115.875",
      "total": "115.875",
      "taxes": [],
      "meta_data":  [] 
    }
  ]

Can i use "fee_lines" for below 'booking fee' and 'waiter tip' in rest API of woocommerce ? If yes then send here example please.

I used like below but not working.

    "fee_lines": [
    {
      "name": "7.5% Booking Fee",
"tax_status" : 'taxable',
      "tax_class": 0,
      "total_tax": "77.25",
      "total": "77.25",
      "taxes": [],
      "meta_data":  [] 
    },
  {
      "name": "Waiter Tip (5%)",
"tax_status" : 'taxable',
      "tax_class": 0,
      "total_tax": "115.875",
      "total": "115.875",
      "taxes": [],
      "meta_data":  [] 
    }
  ]

Share Improve this question edited Feb 12, 2024 at 11:59 fuxia 107k38 gold badges255 silver badges459 bronze badges asked Feb 12, 2024 at 6:41 HeenaHeena 1112 bronze badges 3
  • Tax class = 0 as an integer looks wrong to me - the documentation says it's a string. What do you get back from the list all tax classes endpoint? The example response there has "standard", "reduced-rate" and "zero-rate". You'd hope the API would give you an error if that's the issue though. Any errors in your site's server error log / WordPress debug log / PHP error log if different? – Rup Commented Feb 12, 2024 at 12:44
  • You would do better asking somewhere WooCommerce-specific though, e,g, start at developer.woo.com – Rup Commented Feb 12, 2024 at 12:46
  • @Rup right. Tax class having string. – Heena Commented Feb 13, 2024 at 6:23
Add a comment  | 

1 Answer 1

Reset to default 1

Here is my code that working fine.

"fee_lines": [
        { 
            "name": "7.5% Booking Fee",
            "tax_status": "taxable",
            "tax_class": "",
            "total": "26.02",
            "total_tax": "26.02",
            "taxes": [],
            "meta_data": []
        },
        { 
            "name": "Waiter Tip (5%)",
            "tax_status": "taxable",
            "tax_class": "",
            "total": "8.00",
            "total_tax": "8.00",
            "taxes": [],
            "meta_data": []
        }
    ]

本文标签: How to add feelines using woocommerce rest API v3