Add product with an product addon programatically
Created by: johncarter-
Hi
First, thanks for putting this up, this is a great plugin and your modifications have made it nearly perfect for my use.
I have one question, how would I go about using this plugin to add a product to cart programtically? Is it even possible? I know that Woocommerce has the ability to add products like so:
public function add_to_cart( $product_id, $quantity, $variation_id = '', $variation = '', $cart_item_data = array() ) {
How would the product add ons be parsed in this function?
- Owner
Created by: nextime
Hi John, i really never tried to do that, but it's something i will need to do soon, so, i assume i have to test your use..
- Owner
Created by: valix85
i need some help, i try to catch a product from my cart, i remove it for add it with some addons, a new product is inside a cart with addons array but in cart page i see only my variable product without any addons... i can to do for add many addons in my item cart?
- Owner
Created by: valix85
My trick for only custom field is: in class-product-addon-cart.php at the start paste it:
//valerio i23 if ( isset($_GET['add-to-cart']) and is_numeric($_GET['add-to-cart'])){ $_POST = $_GET; } //fine valerio i23
and next do an ajax call in GET with all parameters addon- example:
- Owner
Created by: nextime
Make sense, can you send a pull request with your changes ( ajax part included )?