Add shipping options to Cart API responses (6271)#4306
Conversation
Test using WordPress PlaygroundThe changes in this pull request can be previewed and tested using a WordPress Playground instance. 🔗 Test this pull request with WordPress Playground What's included:
Login credentials:
Plugin Details:
🤖 Auto-generated for commit c8e3ca6 • Last updated: 2026-04-27T16:14:13.637Z |
The test suite adds many new assertions, most of them verify exiting behavior, while some are failing checks that should pass after this PR
Narek13
left a comment
There was a problem hiding this comment.
Thanks a lot for working on this. LGTM, although haven't tested. Just some questions/doubts regarding ShippingOptionsBuilder
Narek13
left a comment
There was a problem hiding this comment.
Thanks for the clarifications. Looks good to me.
afec75b
into
dev/PCP-4891-agentic-commerce
Description
Extends and refactors the
CartResponseclass to address the following items:Provide a new
shipping_optionsarray in the cart responseWC()->shipping()datashipping_options()Consolidated the
CartResponseclasses, implementing the same factory-method-logic which we use in most other parts of the moduleValidationIssueor inResolutionOptionCartResponseNewCartResponseandPaidCartResponseRefactored the
ResponseFactory, which still is the only place that creates newCartResponseinstancesExtended (and adjusted) the test suite to cover the response expectations more thoroughly