Woocommerce: Adding customizable product seperatly to cart - php

I have product with a custom field. This custom field will be filled by the user (add a custom text).
The problem now is, if the user want to buy twice the same product but with different text, the product will be shown in the cart and also in the order as 1 product with the quantity of 2, instead of two separate products.
Variable product is not an option as every user can enter in the text field whatever they want.
I really digged in to the code, but I don't find the point where I could hook in to.

Related

Change order of dropdowns on single product page

I am trying to change the order of the dropdowns on a variable product in WooCommerce. I want the quantity dropdown to be the first dropdown, and then the variation dropdowns afterwards.
Here is what it looks like now:
I know my way around PHP, MySQL, and some other languages, but I haven't written any custom code yet.
Any suggestions would be outstanding.
You can do this using WooCommerce attributes.
Go through Products > Attributes , in your dashboard.
Select your attribute (eg. Variation Option1) ,
There's an option called "Default sort order", change it to "Custom Ordering".
Go to your product edit page,
In product data section, Attributes tab, change the order of attributes using drag and drop
Save your product
Done!

Woocommerce 3 - Individual Add to Cart Button for Grouped Products

I have a grouped product and on the page there is a table with the individual products. For adding them to the cart you have to select the quantity or use the checkbox (if "sold individually" is selected). The add to cart button is displayed below the table.
I am trying to do the following:
Instead of showing the quantity field or the checkbox i would like to have an individual add to chart button for every individual product in the table.
I have found this question, but it does not work for me: Woocommerce Grouped Products with Individual “Add To Cart” Button
Does anyone has an idea how to do this? Many thanks!

How to set price of product by user, prestashop

Im trying to set custom price for some products entered by user. Simply i have a module with form, and i want user to input price. then the data from user will be used to check out.
Basically, user inputs 45$ for product, he click submit, and i want the product appear in the cart with the price that user specified.
i tried some of these prestashop methods, but there is no way to set price, just quantity and pruduct_id
$cart->updateQty(1,2 );

Magento: pass custom value per product in order

I have created custom field (dropdown field) in Magento cart page. User will able to choose any option from this field. I have created this field manually means I didn't use Magento product custom option. My requirement is that now I want to pass the field value whatever the customer wants per product in order.
thanks

Adding only the base product into cart of a bundled product in Magento

I am trying to add a base product of the bundled item (with no configuration, or additional products added into the bundle). None of the configurable items are required, and the price of the bundled item is set to a fixed price.
I've attempted to try the solution given here: http://www.magentocommerce.com/boards/viewthread/17289/
if (empty($optionIds)) {
// return Mage::helper('bundle')->__('Please select options for product.');
$selectionCollection = $product->getTypeInstance(true)->getSelectionsCollection($product->getTypeInstance(true)->getOptionsIds($product), $product);
$bypass_sel_arry = $selectionCollection->getData();
$options = array($bypass_sel_arry[0]['option_id']=>$bypass_sel_arry[0]['selection_id']);
}
But I've noticed that when the item gets added to cart, it automatically picks up the first option in the configurable items.
Any help would be appreciated.
This will need jQuery involvement.
You should follow the following approach, it is bit tricky but it may resolve your problem.
Associate the simple product with bundle products.
Make the show type check-box.
Display the price of simple products associated in the product view page.
Convert the type check-box to button with text labeled as "Add to cart". This will give you many add to cart buttons on a product detail page.
Pass the id of the product in any attribute of the button.(This will be done via code customization)
//Code to get ID, pass this in any of the button attribute
$product_id = $this->getProduct()->getId();
//Code to get the button clicked id
$("#btnDel").click(function(){alert(this.id);});
When the button is clicked get the id of the product and go to url
http://magentoserver.com/checkout/cart/add?product=[productID]&qty;=1
This will add your product in the Cart.

Categories