0

I'm creating products using a frontend form which submits to commerce/products/saveProduct but it only works when I'm logged-in. They're really complicated products which need to be created on-the-fly.

If it were my own plugin controller I was using, then I could just add protected $allowAnonymous = true; but as it isn't, how would I go about this?

2

You'll have to write a custom plugin and point your frontend form to save to its own controller action that allows anonymous access.

That action can either 1) duplicate Commerce's saveProduct method, which can be brittle if it changes or 2) start a session from a generic user account that has the proper permissions and forward the request onto Commerce's saveProduct method.

Your Answer

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

Not the answer you're looking for?Browse other questions tagged or ask your own question.