Skip to content

Add shipping options to Cart API responses (6271)#4306

Merged
stracker-phil merged 15 commits into
dev/PCP-4891-agentic-commercefrom
dev/PCP-6271-shipping-options
Apr 29, 2026
Merged

Add shipping options to Cart API responses (6271)#4306
stracker-phil merged 15 commits into
dev/PCP-4891-agentic-commercefrom
dev/PCP-6271-shipping-options

Conversation

@stracker-phil

@stracker-phil stracker-phil commented Apr 27, 2026

Copy link
Copy Markdown
Collaborator

Description

Extends and refactors the CartResponse class to address the following items:

  1. Provide a new shipping_options array in the cart response

    • This response is generated by inspecting the WC()->shipping() data
    • Assigned to the cart response via a new setter shipping_options()
    • When the WC object has no shipping options, an empty array is returned
  2. Consolidated the CartResponse classes, implementing the same factory-method-logic which we use in most other parts of the module

  3. Refactored the ResponseFactory, which still is the only place that creates new CartResponse instances

  4. Extended (and adjusted) the test suite to cover the response expectations more thoroughly

@github-actions

github-actions Bot commented Apr 27, 2026

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can be previewed and tested using a WordPress Playground instance.
WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

🔗 Test this pull request with WordPress Playground

What's included:

  • ✅ WordPress (latest)
  • ✅ WooCommerce (latest)
  • ✅ PayPal Payments plugin v4.0.2-pr4306-25006210625-gc33a8db (built from this PR)

Login credentials:

  • Username: admin
  • Password: password

Plugin Details:

  • Version: 4.0.2-pr4306-25006210625-gc33a8db
  • Commit: c8e3ca6
  • Artifact: woocommerce-paypal-payments-4.0.2-pr4306-25006210625-gc33a8db

💡 The demo environment resets each time you refresh. Perfect for testing!

🔄 This link updates automatically with each new commit to the PR.

⚠️ This URL is valid for 30 days from when this comment was last updated.


🤖 Auto-generated for commit c8e3ca6 • Last updated: 2026-04-27T16:14:13.637Z

@stracker-phil
stracker-phil marked this pull request as ready for review April 27, 2026 16:50

@Narek13 Narek13 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks a lot for working on this. LGTM, although haven't tested. Just some questions/doubts regarding ShippingOptionsBuilder

Comment thread modules/ppcp-store-sync/src/Helper/ShippingOptionsBuilder.php Outdated
Comment thread modules/ppcp-store-sync/src/Helper/ShippingOptionsBuilder.php Outdated
Comment thread modules/ppcp-store-sync/src/Helper/ShippingOptionsBuilder.php Outdated

@Narek13 Narek13 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the clarifications. Looks good to me.

@stracker-phil
stracker-phil merged commit afec75b into dev/PCP-4891-agentic-commerce Apr 29, 2026
10 of 11 checks passed
@stracker-phil
stracker-phil deleted the dev/PCP-6271-shipping-options branch April 29, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants