Im in need to create custom update button function in the cart.
Basically I need to add additional input (next to quantity) in the cart and depending on the input value i need to change price of the product in the cart.
Where can I modify function which runs after I hit the update cart button? PHP function together with JS function? Any idea where are those files located and what are function names?
Thanks in adance
Related
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
I am currently working on a ecommerce site. The word press theme I'm using is Astra. I have a form which calculate the prices for certain products. I want the add to cart button to get the final price from the form. How can I do that? Please help.
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/
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
I am new for the wordpress and I am using woocommerce plugin to create an ecommerce website through it.
I want to know that from where the add to cart functionality is being taking place either by template or by some specific function invloved in attempting the add to cart functionality . I am searching for this as I have to add some custom fields other then provided by the woocommerce.
I have to add the field "material type and description" for the product which is being dynamically generated at the client end.and I have to add that dynamically generated values to the cart and also I have to add this to the Database table as well . so that it will be available through the checkout page.
Please hemp me to solve the Issue.
As I have search to display the cart "cart.php template "is available but it is not showing the code for add to cart.