Edit Product Meta Data after adding to cart, Woocommerce - php

I'm new to wordpress and woocommerce, I need to edit few Product Meta Data of a product after it has been added to cart. I've used "WooCommerce Product Gift Wrap". I need to add a option to allow users to remove gift wrap (If they had selected from product page) and update the product pricing as well.
I tried to change value with $values['gift_wrap'] = "0";, but when I print the meta array again, I cannot change the actual data which woocommerce takes from session (or something else). Kindly check the attached image link for better understanding.
Thank you.

Related

Auto add tag to product after WooCommerce purchase

Is there a way to automatically apply a tag to a product in WooCommerce after it has been purchased the first time?
I've got it set up to display a "Sold Out" banner on any product with the tag "Sold". I now just need the system to auto apply that tag after purchase of that specific product (not others).
I need it done using tags (as opposed to out of stock) for a reason, as I'm using out of stock to do something different.
Please help,
-Kraig

Add to cart button showing in configurable products but not in simple products in magento

http://geecosme.nextmp.net/weaves/human-multiway-weave-135/human-multiway-weave.html
Its a configurable product.
here you could see that add to cart ('add to bag') button is there.
http://geecosme.nextmp.net/weaves/human-multiway-weave-135/human-multiway-weave-18-inches-darkest-black-120-grams.html
This is a simple product
In this simple product add to cart button is not showing. I have checked everything from quantity to availability and even reindexed data after setting manage to No. still nothing.
Its ajax based add to cart button.
Simple products that have a parent configurable product shouldn't be visible individually.
Magento will check if it has a stock on the simple product and will show it as an option in configurable.

Woocommerce separate orders when add to cart is clicked

I put a few custom fields as part of the add to cart form and I'm trying to separate the orders every time the add to cart button is clicked.
Right now when I order an item and fill up the form I get 1 item added to cart and if I fill up the form again with different data and click add to cart the new data gets lost and the count of the first product is increased to 2.
At the same time when viewing the cart page I want to be able to increase the count of separate orders when changing the count and clicking update chart.
What hook can I use to accomplish this? Thanks.
Don't add fields directly to add to cart form.
From admin panel make your product variant product. There you can add product variants like color, size etc. You can add your own variations also. This will automatically create extra fields to add to cart field.
Then, your products will be added separately.
Check out the link:
https://docs.woothemes.com/document/variable-product/

How to add an input filed to single product page in woocommerce to store extra user comments in the order?

I am using latest wp and wc and I am trying to add a form field in the frontend single product page where the user will be able to add comments which when the order is done the data will be available under woocommerce -> orders. Have anybody done that or it's not even possible because woocommerce is pretty limited for stuff like this?

WooCommerce, manually add a product and price for purchase

I'm trying to figure out if there's a way to use the WooCommerce Cart and Checkout functionality if I need to purchase something that isn't technically a product
In other words, it's a completely independent "membership" that needs to be purchased, but isn't a product post.
I'd love to be able to add an item in the cart manually ... manual name, manual price, manual meta data and then purchase.
Does anyone have any idea how to do this?
here is example
global $woocommerce;
$woocommerce->cart->add_to_cart(16);
16 -> this is ID of existing product in store
documentation Link

Categories