Skip to content

fix: serialize order fee line tax as string - #812

Open
ArnoutPullen wants to merge 1 commit into
XiaoFaye:masterfrom
ArnoutPullen:fix/OrderLineFeeTaxStatus
Open

ArnoutPullen wants to merge 1 commit into
XiaoFaye:masterfrom
ArnoutPullen:fix/OrderLineFeeTaxStatus

Conversation

@ArnoutPullen

Copy link
Copy Markdown

Fixes WooCommerce order updates failing when fee_lines[].total_tax is serialized as a decimal instead of a string.

WooCommerce Rest API Error:
{ "code": "rest_invalid_param", "message": "Invalid parameter(s): fee_lines", "data": { "status": 400, "params": { "fee_lines": "fee_lines[0][total_tax] is not of type string." }, "details": { "fee_lines": { "code": "rest_invalid_type", "message": "fee_lines[0][total_tax] is not of type string.", "data": { "param": "fee_lines[0][total_tax]" } } } } }

See WooCommerce Rest Api Docs.

Copilot AI lite review requested due to automatic review settings September 8, 2026 14:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is small, consistent with the library’s existing decimal-to-string serialization pattern, and directly addresses the documented WooCommerce API type requirement.

Pull request overview

This PR fixes WooCommerce order update requests failing due to fee_lines[].total_tax being serialized as a JSON number instead of the string type required by the WooCommerce REST API schema.

Changes:

  • Adds a total_taxValue backing member (typed as object) with DataMember(Name = "total_tax") to control JSON serialization shape.
  • Removes the DataMember attribute from the decimal? total_tax property so the backing member is serialized instead (consistent with existing total handling in the same class).
File summaries
File Description
WooCommerce/v2/Order.cs Adjusts OrderFeeLine.total_tax serialization to emit a string value via the established *Value DataMember pattern, preventing WooCommerce “not of type string” validation errors.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants