Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

getCurrencyPrecision not available since shopware 6.4.0 #48

Open
Nico-Schaefer-2111 opened this issue Jun 22, 2021 · 7 comments
Open

getCurrencyPrecision not available since shopware 6.4.0 #48

Nico-Schaefer-2111 opened this issue Jun 22, 2021 · 7 comments

Comments

@Nico-Schaefer-2111
Copy link

https://github.com/shopware/swag-docs-bundle-example/blob/4d787fd898a2c7c2d1b7edf403183668cd46c6c9/src/Core/Checkout/Bundle/Cart/BundleCartProcessor.php

the method 'getCurrencyPrecision' is not part of the context class anymore.

@fgiering
Copy link

same here

@Nico-Schaefer-2111
Copy link
Author

@fgiering you can just leave it out.

@fgiering
Copy link

@fgiering you can just leave it out.

You mean like:
$priceDefinition = new AbsolutePriceDefinition($bundleData->getDiscount() * -1);
instead of
$priceDefinition = new AbsolutePriceDefinition($bundleData->getDiscount() * -1, $context->getContext()->getCurrencyPrecision());
?

@Nico-Schaefer-2111
Copy link
Author

yep, exactly

@fgiering
Copy link

Then I get a RuntimeException
Product "" has invalid price definition

@Nico-Schaefer-2111
Copy link
Author

Nico-Schaefer-2111 commented Jun 25, 2021

Can you Debug it a bit more, which value is set there?
In Shopware 6.4.0 I used it with a static integer like:

$lineItem->setPriceDefinition( new AbsolutePriceDefinition(5) )

This works fine for me
Maybe you got there a float with more than 2 decimal places ?

@fgiering
Copy link

Got it. There was an inactive Product in the Bundle.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants