Answers.Body: <p>I don't think you can do it like that - in Commerce, the order gets completed when a payment is made.</p>
  
  <p>Fortunately, you can use the manual payment mechanism, which automatically completes the order, as the fake 'payment' type to get this to occur.  Just go in to Commerce settings and create a new payment type of 'manual' set to 'authorize only', and give it a name like 'Get Quote'.</p>
  
  <p>To actually complete the order, you'll need to post the manual <code>paymentMethodId</code> to a call to <code>commerce/payments/pay</code>.  If you're doing this in a contact form, you'll have to intercept the form submit and post this via AJAX I guess.</p>
  
  <p>Alternatively you could write your own controller to complete the order with some plugin code, but the above solution is essentially built in an intended for this sort of thing.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-10T14:05:44.317Z
Answers.Text: Full success. I set up a Manual payment method and added its ID as a hidden field. Then just changed the action as you suggested. I don't think I'll  need a contact form, since I think I can just customize this form as it is.
Answers.UserDisplayName: Matt Everson
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-10T05:04:48.010Z
Answers.LastActivityDate: 2017-05-11T05:15:45.133Z
Answers.LastEditDate: 2017-05-11T05:15:45.133Z
Answers.UserDisplayName: Jeremy Daalder
Body: <p>I'm building a site that is driven by Craft Commerce but does not take payment online. Rather, the customer adds what they need to a cart and submits to the company for a quote. </p>
  
  <p>I need to build a contact form that allows the customer to submit their name, email, phone, and company name. When submitted, the form should also turn the cart into an order. I've tried setting 'isCompleted' to 'true' and setting the 'dateOrdered' but cannot seem to get the cart to transition into an order.</p>
  
  <p>Below is the code I've been testing to try to get the cart to convert into an order. I feel like I'm missing something obvious. Any advice is appreciated.</p>
  
  <pre><code>&lt;form method="POST"&gt;
      &lt;input type="hidden" name="action" value="commerce/cart/updateCart"&gt;
      &lt;input type="hidden" name="isCompleted" value="1"&gt;
      &lt;input type="hidden" name="dateOrdered" value="{{ now.format('Y-m-d H:i:s')}}"&gt;
      {{ getCsrfInput() }}
  
      &lt;input type="submit" value="Submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>Edit:</strong> Here's the working code as suggested below, where "2" is the ID of the manual payment method I created.</p>
  
  <pre><code>&lt;form method="POST"&gt;
      &lt;input type="hidden" name="action" value="commerce/payments/pay"&gt;
      &lt;input type="hidden" name="paymentMethodId" value="2"&gt;
      {{ getCsrfInput() }}
  
      &lt;input type="submit" value="Submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
Tags: <plugin-craftcommerce>
Title: How do I change a cart into an order?
ThreadText: # How do I change a cart into an order?
  
  (Asked by: username_0 on 2017-05-10)
  
  I'm building a site that is driven by Craft Commerce but does not take payment online. Rather, the customer adds what they need to a cart and submits to the company for a quote.
  
  I need to build a contact form that allows the customer to submit their name, email, phone, and company name. When submitted, the form should also turn the cart into an order. I've tried setting 'isCompleted' to 'true' and setting the 'dateOrdered' but cannot seem to get the cart to transition into an order.
  
  Below is the code I've been testing to try to get the cart to convert into an order. I feel like I'm missing something obvious. Any advice is appreciated.
  
  ```
  <form method="POST">
      <input type="hidden" name="action" value="commerce/cart/updateCart">
      <input type="hidden" name="isCompleted" value="1">
      <input type="hidden" name="dateOrdered" value="{{ now.format('Y-m-d H:i:s')}}">
      {{ getCsrfInput() }}
  
      <input type="submit" value="Submit">
  </form>
  
  ```
  
  **Edit:** Here's the working code as suggested below, where "2" is the ID of the manual payment method I created.
  
  ```
  <form method="POST">
      <input type="hidden" name="action" value="commerce/payments/pay">
      <input type="hidden" name="paymentMethodId" value="2">
      {{ getCsrfInput() }}
  
      <input type="submit" value="Submit">
  </form>
  
  ```
  
  **Tags:** plugin-craftcommerce
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-05-10. Score: 2 | Accepted answer
  
  I don't think you can do it like that - in Commerce, the order gets completed when a payment is made.
  
  Fortunately, you can use the manual payment mechanism, which automatically completes the order, as the fake 'payment' type to get this to occur. Just go in to Commerce settings and create a new payment type of 'manual' set to 'authorize only', and give it a name like 'Get Quote'.
  
  To actually complete the order, you'll need to post the manual `paymentMethodId` to a call to `commerce/payments/pay`. If you're doing this in a contact form, you'll have to intercept the form submit and post this via AJAX I guess.
  
  Alternatively you could write your own controller to complete the order with some plugin code, but the above solution is essentially built in an intended for this sort of thing.
  
  > **Comments:**
  > **username_0**: Full success. I set up a Manual payment method and added its ID as a hidden field. Then just changed the action as you suggested. I don't think I'll  need a contact form, since I think I can just customize this form as it is.  
  
  ---
  
  