Answers.Body: <p>I created a simple plugin to redirect using the <a href="https://craftcommerce.com/docs/events-reference#commerce_cart.onaddtocart" rel="nofollow">onAddToCart method</a></p>
  
  <pre><code>  craft()-&gt;on('commerce_cart.onAddToCart', function($event){
  
        $lineItem = $event-&gt;params['lineItem'];
  
        craft()-&gt;request-&gt;redirect("/commerce/item/?item=" . $lineItem-&gt;id);
  
    });
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-02T09:11:01.893Z
Answers.LastActivityDate: 2016-10-02T16:51:29.803Z
Answers.LastEditDate: 2016-10-02T16:51:29.803Z
Answers.UserDisplayName: Richard Frank
Body: <p>I'm building a craftcommerce based site, where each item added to the cart must be individually customised through a wizard interface.</p>
  
  <p>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</p>
  
  <p>Something like the redirect shown below:</p>
  
  <pre><code>&lt;input type="hidden" name="action" value="commerce/cart/updateCart"&gt;
  &lt;input type="hidden" name="redirect" value="commerce/item?item={id}"&gt;
  &lt;input type="hidden" name="qty" value="1"&gt;
  &lt;input type="hidden" name="purchasableId" value="{{ purchasable.purchasableId }}"&gt;
  &lt;input type="submit" value="{{ "Buy"|t }}" class="btn btn-default"/&gt;
  </code></pre>
  
  <p>This is possible with user form submission for instance, where the newly created user id is accessible via the method described above.</p>
  
  <p>Any ideas on how I would go about doing this?</p>
  
Tags: <plugin-craftcommerce>
Title: Craft Commerce: After add to cart, redirect to specific line item
ThreadText: # Craft Commerce: After add to cart, redirect to specific line item
  
  (Asked by: username_0 on 2016-10-02)
  
  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?
  
  **Tags:** plugin-craftcommerce
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-10-02. Score: 2
  
  I created a simple plugin to redirect using the [onAddToCart method](https://craftcommerce.com/docs/events-reference#commerce_cart.onaddtocart)
  
  ```
    craft()->on('commerce_cart.onAddToCart', function($event){
  
        $lineItem = $event->params['lineItem'];
  
        craft()->request->redirect("/commerce/item/?item=" . $lineItem->id);
  
    });
  
  ```
  
  
  ---
  
  