Answers.Body: <p>You would need to use javascript to change the <code>redirect</code> input's value</p>
  
  <p><code>&lt;input type="hidden" name="redirect" value="commerce/cart"&gt;</code></p>
  
  <p>For example on the 'add and create new item' button you could do something like this using jQuery:</p>
  
  <pre><code>   $('.addAndCreateNewBtn').click(function(e){
         e.preventDefault();
         var $form = $(this).closest('form');
         $form.find("input[name='redirect']").val('anotherUrl');
         $form.submit();
     });
  </code></pre>
  
  <p>The above is untested, but should replace the redirect value then submit the form.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-23T08:37:39.707Z
Answers.Text: This redirects to the same page but it doesn't add an item to the cart.
Answers.UserDisplayName: Dan Lee
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-27T07:10:40.207Z
Answers.Text: is there another error on the page?
Answers.UserDisplayName: Luke Holder
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-27T09:00:33.503Z
Answers.Text: No - I have decided to to go this route. as there needs to be some kind of feedback to the customer that the item has been placed into the cart.
Answers.UserDisplayName: Dan Lee
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-23T08:17:39.903Z
Answers.LastActivityDate: 2016-06-23T08:17:39.903Z
Answers.UserDisplayName: Luke Holder
Body: <p>On my product page I have the default button that "Adds to cart" which adds a line item to the cart and take you to the cart page. </p>
  
  <p>How do I create a second button alongside the default that adds the line item to the cart BUT then redirects the customer to the same page to select and customise another line item to add to cart?</p>
  
  <p>Note: Ill very likely change the styling and text on the button (just in case anyone is concerned about usability) ;)</p>
  
  <p><a href="https://i.sstatic.net/RyFI5.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/RyFI5.png" alt="Add to cart"></a></p>
  
Tags: <plugin-craftcommerce>
Title: Craft Commerce: Add to Cart and then Redirect to Product Page?
ThreadText: # Craft Commerce: Add to Cart and then Redirect to Product Page?
  
  (Asked by: username_0 on 2016-06-23)
  
  On my product page I have the default button that "Adds to cart" which adds a line item to the cart and take you to the cart page.
  
  How do I create a second button alongside the default that adds the line item to the cart BUT then redirects the customer to the same page to select and customise another line item to add to cart?
  
  Note: Ill very likely change the styling and text on the button (just in case anyone is concerned about usability) ;)
  
  [![Add to cart](https://i.sstatic.net/RyFI5.png)](https://i.sstatic.net/RyFI5.png)
  
  **Tags:** plugin-craftcommerce
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-06-23. Score: 1
  
  You would need to use javascript to change the `redirect` input's value
  
  `<input type="hidden" name="redirect" value="commerce/cart">`
  
  For example on the 'add and create new item' button you could do something like this using jQuery:
  
  ```
     $('.addAndCreateNewBtn').click(function(e){
         e.preventDefault();
         var $form = $(this).closest('form');
         $form.find("input[name='redirect']").val('anotherUrl');
         $form.submit();
     });
  
  ```
  
  The above is untested, but should replace the redirect value then submit the form.
  
  > **Comments:**
  > **username_0**: This redirects to the same page but it doesn't add an item to the cart.  
  > **username_1**: is there another error on the page?  
  > **username_0**: No - I have decided to to go this route. as there needs to be some kind of feedback to the customer that the item has been placed into the cart.  
  
  ---
  
  