Skip to content

Always add currency to cart (6272)#4311

Merged
stracker-phil merged 11 commits into
dev/PCP-4891-agentic-commercefrom
dev/PCP-6272-always-add-currency
Apr 30, 2026
Merged

Always add currency to cart (6272)#4311
stracker-phil merged 11 commits into
dev/PCP-4891-agentic-commercefrom
dev/PCP-6272-always-add-currency

Conversation

@stracker-phil

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

Copy link
Copy Markdown
Collaborator

This PR extends #4306

Description

The totals calculation requires a valid currency code to work, as a money value without a currency code is invalid.

Current Behavior

  • The Cart API waits until PayPal provides a currency.
  • This does not happen in early requests, and as a result we do not include price or currency details in the response
  • Postman collection: Expects to see minimal cart totals immediately after an item was added

New Behavior

  • When there is no currency code defined in the incoming PayPal cart, the Cart API falls back to use Woo's currency
  • This unlocks totals calculation as soon as an item is in the cart
  • Postman collection: Confirms that our API is working as expected
  • Consequence: The AI agent can infer the currency and product price from the response, instead of relying on the product catalog

@github-actions

github-actions Bot commented Apr 28, 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-pr4311-25164922827-g897e398 (built from this PR)

Login credentials:

  • Username: admin
  • Password: password

Plugin Details:

  • Version: 4.0.2-pr4311-25164922827-g897e398
  • Commit: e736ad8
  • Artifact: woocommerce-paypal-payments-4.0.2-pr4311-25164922827-g897e398

💡 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 e736ad8 • Last updated: 2026-04-30T12:23:13.019Z

@stracker-phil
stracker-phil marked this pull request as ready for review April 28, 2026 15:27
@stracker-phil
stracker-phil changed the base branch from dev/PCP-4891-agentic-commerce to dev/PCP-6271-shipping-options April 28, 2026 15:28
Base automatically changed from dev/PCP-6271-shipping-options to dev/PCP-4891-agentic-commerce April 29, 2026 12:29

@danieldudzic danieldudzic 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 working on this. Just a few minor issues.

Comment thread modules/ppcp-store-sync/src/Config/StoreCurrencyValue.php
Comment thread tests/PHPUnit/StoreSync/Config/StoreCurrencyValueTest.php Outdated
Comment thread modules/ppcp-store-sync/src/Response/ResponseFactory.php Outdated
@stracker-phil
stracker-phil merged commit ca37a96 into dev/PCP-4891-agentic-commerce Apr 30, 2026
11 of 12 checks passed
@stracker-phil
stracker-phil deleted the dev/PCP-6272-always-add-currency branch April 30, 2026 12:25
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