Drupal Commerce Programmatically Complete order and create new cart - drupal

Is there anything i have to do to programmatically complete order and create new cart so the new items is not added to the old order/cart?

There is no new cart or old cart. The cart keeps track of record per user. And for each item you add to cart, there is a record inserted in cart table. If you intend to separate the order per item, you have to write some code. Also try CA

Related

How to generate one cart with multiple items using BigCommerce cart API in nextjs

I am using BigCommerce API with Nextjs and I am trying to understand how cart API works from BC ( https://developer.bigcommerce.com/api-reference/20c2c55c1763f-create-a-cart ).
When I implement it as it is there, whenever I click on Add to cart button (same/different item ) it generates a new cart with that item.
I don't know how to keep adding items to the same cart (with the same cart-id, etc). There is no API for updating the current cart (i.e. send PUT req with new items on api/cart/cart-id).
Is there any other solution?
Have you checked out the Add Cart Line Items Storefront API? I think this might be what you are looking for to add products to an existing cart.
A

Is it possible to field map wpforms data to woocommerce products and add the items to cart?

I am using wpforms elite (with webhooks) in hopes to simplify the order process for woocommerce customers.
When a user submits the form at this url, http://implantlogic.wpengine.com/device-selection/ I hope to have products added to the cart based on users selections.
For example, if the user selects tooth one on the tooth selection page of the form, this product will need to be added to the cart with all fields populated http://implantlogic.wpengine.com/product/tooth-1/ and this applies to other things the user selects on the form as well which would trigger simple field mapping or the addition of simple products to the cart.
Right now I just need to know if this is possible or if I should seek other methods to solve this issue and create the same experience.

Want to add custom field at time of update cart in woocommerce

I want to add a new custom field in woocomerce cart while updating cart on cart page for indivdual cart items(not on product page).
how can i do this? Can any one suggest me a filter/action for this i am new with woocomerce. thanks.
Make a condition wrt your product ID at cart page and create a custom field.
Hope this link can help you in creating the field.
http://uploadwp.com/community/index.php?threads/add-custom-field-on-cart-page.476/

WooCommerce: Override product info before adding to cart

I've found the following example (WooCommerce: Add product to cart with price override?) which lets the user add a product to the cart. However, it hard codes the prices directly on the cart itself.
Is there a way to make adjustments to a product instance i.e. costs, append additional user input, etc. and then add the product to the cart?
Thank you very much for everyones help.
Edit:
Having another crack at explaining, as doublesharp has pointed out it's not quite clear.
Joe clicks on a product, he then chooses various options on the product form which then calculates a custom cost after the 'add to cart' button is clicked but before it is added to the cart.
These options need to be completely custom as the calculations involved are outside of scope of a woocommerce 'variable product'. What I'm trying to achieve is the customer being able to add multiple instances of the same product with various costs and info associated with it.
With regards to the first part of your question where you want to add multiple instances of a product with various costs, you can have a look at the following plugins to achieve that objective
Dynamic Pricing
Pricing Deals for WooCommerce
As for the second part of your question where you want to append additional user input to the cart. This can be done using the following steps
Create a custom session and add the custom data to this session.
Add the data from the custom session to the WooCommerce session.
Extract custom data from WooCommerce session and insert it into cart
object.
Display custom data in Cart and Checkout page.
Add custom data as metadata to the order items.
Remove the associated custom data if an item is removed from the
cart.
For a more detailed on the above steps you have a look at the following link,
How to Add Custom Data to WooCommerce Order

Drupal Commerce Ajax cart with added fields

Sorry for the really bad title but wasn't sure how to describe my problem in 10 words.
I have drupal commerce and have made a view that displays the cart contents on top of the checkout page.
Quantity is a text field so it is editable and I have an update button. Unfortunately when I press the update button, naturally the whole checkout page tries to submit. Is there a way to intercept the update button and just refresh the cart with ajax?
Moreover, if I can do that, I want a number of text fields (as many as the quantity number entered) to appear underneath the cart so the user can enter different values on each of them (each referring to the products about to be bought).
Drupal Commerce Cart does this - sort of.. http://drupal.org/project/dc_cart_ajax
It works fine on the cart page, though I too am trying to combine these pages to cut down on the 'checkout steps'. Though it is the same view as the /cart page and I get an ajax refresh indicator it doesn't actually update the cart on the checkout page.
There is a issue related to that, you can subscribe: http://drupal.org/node/1443470
You can disable the Shopping cart contents using the checkout settings. Modify the Shopping Cart View to add a block display and add modify the contextual filter by providing default value using PHP:
if (arg(0) == 'checkout') return arg(1);
else return null;
Add the new Shopping cart block dispplay only on the checkout page and here you go.

Resources