Skip to content

Conversation

@gapon2401
Copy link
Contributor

Hook will help to change order items.

I have plugin (Gift certificates), which changes prices of order items. One product can have different prices, depends on the amount of the certificate.
For now it's imposible to edit definite item in the order. I was trying to change item price with the help of frontend_products hook, but I found, that skus in some cases don't contain item ids.

What am I trying to achieve?
I want to:

  • edit item price depends on certain item ID,
  • calculate relevant order discount
    Method shopCart::discount use function shopCartItemsModel::getByCode to get order items. If you add hook cart_items_after, I will be able to change prices of the items.

What issues have users?
In some places of the website users see wrong discounts and item prices.

Hook will help to change order items. 
I have plugin (Gift certificates), which changes prices of order items. One product can have different prices, depends on the amount of the certificate.
For now it's imposible to edit definite item in the order. I was trying to change item price with the help of `frontend_products` hook, but I found, that skus in some cases don't contain item ids. 

What am I trying to achieve? 
I want to:
- edit item price depends on certain item ID,
- calculate relevant order discount 
Method `shopCart::discount` use function `shopCartItemsModel::getByCode` to get order items. If you add hook `cart_items_after`, I will be able to change prices of the items.
What issues have users?
In some places of the website users see wrong discounts and item prices.
@mikeushenin
Copy link

You should be able to solve your problem by using recently added hooks controller_before.* and controller_after.*. Let us know if they are not useful enough for the described purpose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants