2

I'm building a craftcommerce based site, where each item added to the cart must be individually customised through a wizard interface.

When the item first gets added to the cart, I'd like to immediately redirect to a page where we can customise the item further

Something like the redirect shown below:

<input type="hidden" name="action" value="commerce/cart/updateCart">
<input type="hidden" name="redirect" value="commerce/item?item={id}">
<input type="hidden" name="qty" value="1">
<input type="hidden" name="purchasableId" value="{{ purchasable.purchasableId }}">
<input type="submit" value="{{ "Buy"|t }}" class="btn btn-default"/>

This is possible with user form submission for instance, where the newly created user id is accessible via the method described above.

Any ideas on how I would go about doing this?

2

I created a simple plugin to redirect using the onAddToCart method

  craft()->on('commerce_cart.onAddToCart', function($event){

      $lineItem = $event->params['lineItem'];

      craft()->request->redirect("/commerce/item/?item=" . $lineItem->id);

  });
| improve this answer | |

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.