Skip to content

App FAQ: How to manipulate prices / tax rules #3517

Answered by OliverSkroblin
codixio asked this question in App FAQ
Discussion options

You must be logged in to vote

Hi @codixio,

I looked at your problem. I'm sorry the documentation seems to be incorrect here, because:

  1. To access data in a hook, you also have to access them via the hook object
  2. The hook receive multiple products, not just one, i.e. the reference to the loop would be important in the documentation here

The following code worked for me:

{% foreach hook.products as product %}
    {% do product.calculatedCheapestPrice.reset %}
    {% do product.calculatedPrices.reset %}

    {% set price = services.price.create({
        'default': { 'gross': 24.00, 'net': 20.00}
    }) %}

    {% do product.calculatedPrice.change(price) %}
{% endforeach %}

I will update the documentation, sorry for the t…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by codixio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
App FAQ
2 participants