0

I want to add current customer session custom field to the every category url.

lets say if user typed in the browser http://test.html , this should forcefully change to http://test.html?customer_number=1234.

lets say url is http://test.html?color=red ,this should forcefully change to http://test.html?color=red&&customer_number=1234

5
  • you can do that by creating a custom router that checks for the parameter customer_number. if it's not set, set it and redirect to the new url: devdocs.magento.com/guides/v2.4/extension-dev-guide/…. But I have a feeling you're doing something wrong. If you want customer specific content, use the session to do that not GET params
    – Marius
    Jun 4, 2021 at 8:13
  • @marius some skus i need to display specific customers only, some skus i need to display for all the customers. product level I created customer_number attribute. basically I need to add forcefully this customer_number as filter to all categories
    – sivakumar
    Jun 4, 2021 at 8:30
  • that's what I thought. you should do this based on the session information not trying to enforce a get parameter for all urls. What happens if the customer changes that parameter manually?
    – Marius
    Jun 4, 2021 at 15:23
  • even if they change, we should not allow ,we need to check current customer session field
    – sivakumar
    Jun 8, 2021 at 8:06
  • I'm trying to do the same thing, and it's required because of Varnish.
    – TheTC
    Mar 9, 2022 at 16:11

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.