-
Notifications
You must be signed in to change notification settings - Fork 70
Always add currency to cart (6272) #4311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
stracker-phil
merged 11 commits into
dev/PCP-4891-agentic-commerce
from
dev/PCP-6272-always-add-currency
Apr 30, 2026
Merged
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
c3ab3bc
✨ New service to retrieve Woo's currency code
stracker-phil 04b13e4
✅ Add tests for the StoreCurrencyValue class
stracker-phil c65e0fd
🏗️ Inject the store currency into response factory
stracker-phil 99d397f
🔀 Merge branch 'dev/PCP-6271-shipping-options'
stracker-phil c1c6f0b
✨ Add a new default-currency to CartResponse
stracker-phil 8a87ac2
🏗️ Inject new store currency into CartResponse
stracker-phil 9703f7f
🔀 Merge branch 'dev/PCP-4891-agentic-commerce'
stracker-phil 324ef62
🔀 Merge branch 'dev/PCP-6271-shipping-options'
stracker-phil dfb33dd
♻️ Clean up redundant tests
stracker-phil f9ad63f
🔥 Remove comment noise from constructor
stracker-phil e736ad8
🔀 Merge branch 'dev/PCP-4891-agentic-commerce'
stracker-phil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <?php | ||
|
|
||
| namespace WooCommerce\PayPalCommerce\StoreSync\Config; | ||
|
|
||
| class StoreCurrencyValue { | ||
| public function value(): string { | ||
| return get_woocommerce_currency(); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| <?php | ||
| declare( strict_types = 1 ); | ||
|
|
||
| namespace WooCommerce\PayPalCommerce\StoreSync\Config; | ||
|
|
||
| use WooCommerce\PayPalCommerce\TestCase; | ||
| use function Brain\Monkey\Functions\when; | ||
|
|
||
| /** | ||
| * @covers \WooCommerce\PayPalCommerce\StoreSync\Config\StoreCurrencyValue | ||
| */ | ||
| class StoreCurrencyValueTest extends TestCase { | ||
|
|
||
| /** | ||
| * GIVEN the StoreCurrencyValue class with no required constructor arguments | ||
| * WHEN the class is instantiated | ||
| * THEN an instance is created successfully | ||
| */ | ||
| public function test_can_be_instantiated(): void { | ||
| $testee = new StoreCurrencyValue(); | ||
|
|
||
| $this->assertInstanceOf( StoreCurrencyValue::class, $testee ); | ||
| } | ||
|
|
||
| /** | ||
| * GIVEN a StoreCurrencyValue instance | ||
| * WHEN the value() method is inspected | ||
| * THEN it exists and is callable on the public API | ||
| */ | ||
| public function test_value_method_is_callable(): void { | ||
| $testee = new StoreCurrencyValue(); | ||
|
|
||
| $this->assertTrue( is_callable( array( $testee, 'value' ) ) ); | ||
| } | ||
|
stracker-phil marked this conversation as resolved.
Outdated
|
||
|
|
||
| /** | ||
| * GIVEN the WooCommerce store is configured with USD as the active currency | ||
| * WHEN value() is called | ||
| * THEN it returns the string 'USD' | ||
| */ | ||
| public function test_value_returns_woocommerce_currency_code(): void { | ||
| when( 'get_woocommerce_currency' )->justReturn( 'USD' ); | ||
|
|
||
| $testee = new StoreCurrencyValue(); | ||
|
|
||
| $this->assertSame( 'USD', $testee->value() ); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.