1

My customer wants to have custom prices for each customer. He already has an existing system where he holds such data where we can invoke an API call to retrieve it based on the customerREF and SKU.

How can i do this in Magento2 itself? I see a lot of plugins but most of them are way too much overhead.

I thought below steps are needed but no idea where i need to implement this:

  • Ensure that no prices are shown on the category index pages and such. I can overwrite this method? Magento\Catalog\Pricing\Render\FinalPriceBox:wrapResult
  • When a product detail page is opened i invoke an API call to retrieve the actual price. I can add some basic caching for lets say 5 min to ensure that there is not too much overhead
  • How can i ensure when a product is added to the cart, that specific price is also used?

I know there are some events as well. No idea how to get the actual price there then though:

  • checkout_cart_product_add_after
  • checkout_cart_product_update_after
  • sales_quote_item_qty_set_after
  • checkout_cart_product_update_after

Best, Pim

5
  • How many customers/products there are in the system? If relatively small amount you could assign each customer to their own Customer Group and set price per Customer Group. Thanks to that no customization will be required. Jun 8, 2021 at 7:51
  • About 1000 customers and 400 products (2 websites)
    – Dirkos
    Jun 8, 2021 at 7:54
  • @MichałBiarda the thing is that all customers are already in a group (to determine what type of customer it is). I do not want to lose that though
    – Dirkos
    Jun 8, 2021 at 8:18
  • do you use Customer Groups for anything else than just "determining what type of customer it is"? If no, then you could create a custom attribute "customer_type" and store this info in there. Jun 8, 2021 at 8:27
  • The other advantage of this approach vs. frontend customization is that filtering and sorting by price will work out-of-the-box (frontend customization will break filtering and sorting). Jun 8, 2021 at 8:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.