How to make Qty Attribute for Woocommerce - php

How can we make custom attributes as quantity.
I want to make quantity attributes so it would be easy for the customers buy in bulk with pre-defined options.
Example: X product with attributes 3,5,10 so when user select 3 and add to cart it gonna add X product 3 qty with showing total price for 3 or if they selected 5 then 5 qty it gonna add up with showing the price of 5 qty.
Something like this

Step 1: Select Product > Variable Product
Step 2: Create Attribute > Add Label as Quantity & Values 3, 5, 10 etc
Step 3: Create Variations > It will ask to create Variable Products using Attributes. Click Yes
Step 4: You can add Prices as per your Quantity in generated products after Step 3.
(You can also add images as per your quantities if you wish)

Related

woocommerce different prices based in weight

It is posible in woocommerce to create different prices based in weight to display in a select dropdown?
For example:
food for dogs:
5k = $20
10k = $40
20k = $60
It is possible in WooCommerce to create different prices based on weight -
In Variable products in WooCommerce that lets you offer a set of variations on a product, with control over prices, stock, image and more for each variation.
Step 1- Set the product type
Go to: WooCommerce > Products.
Select the Add Product button or Edit an existing product. The Product Data displays.
Select Variable product from the Product Data dropdown.
Step 2- Add attribute.
Go to : Products > Attributes
Then give name attribute.
Save.
Then select on weight attribute.
Add sub-attribute in weight attribute (5k,10k,15k).
Step 3- Add attributes to use for variations
Go to : Products
Then select product you set as variable product in step 1
Select Attributes then select Custom product attribute(that is weight), and Add.
In weight select sub-attribute.
Then Select check box used for variation.
Save attribute.
Step 4. Add variations
Goto:Variations Select Add variation from the drop-down menu, and click Go
Select attributes for your variation. To change additional data, click the triangle icon to expand the variation.
Edit Price for each attribute.
Save Changes.
Read more: https://docs.woocommerce.com/document/variable-product/
Watch this Video- https://www.youtube.com/watch?v=iUcAf89LfCc
https://www.youtube.com/watch?v=aen8ieJuB88
Step 1: Go to product edit page, for which you like to set prices based on weight.
Step 2: Select Product Type as a variable product, see the image below. Create product attribute, save the attribute. I named the attribute weight .
See the image below:
Step 3: Now we need to add product variation, see the image below:
Step 4: For each of these variation, u can set any prices you want, see the image below
Step 5: update the product, that's it.

Open cart multiple Quantities with different pricing

I was wondering if there was an easy way on opencart(2.0.x) to let a user buy a product in 3 different Quantity options. 3,6, or 12 quantity, with each quantity having a unique price. (I.E- QTY 3 would sell for 10, QTY 6, 8.50, then 12 pack for 7). I tried to use the options module, to create a few radio button options but that tacks on the option to the original set price. I want the only options available to be the 3 types of quantity options. so if i choose the 3 QTY option I only pay $10.
Thank you in advance
No modifications are needed for this.
Go to the product's edit page and look at the discounts tab. In here you can put different quantities and prices. Note that the price field is per item, so you just need to divide your total by the number of products.
You can leave the start and end dates empty if they aren't appropriate.
There is a demonstration of this functionality on the official demo site and (I think) the dummy data provided when you first install OpenCart.

Cart items in magento

I want to display the cart items in magento. Currently it's display on the basis on product qty, but I want to display them on number of product added into the cart.
E.g. If I added 1 product of 1kg and other product of 0.500grms then in header displays 1.5 items, I want to display it as 2 items.
Any suggestions? My Magento version is 1.9.0.1
There are 2 functions available for Item count.
1) Mage::helper('checkout/cart')->getItemsCount() -- return shopping cart items count means how many sku add to shopping cart.
2) Mage::helper('checkout/cart')->getSummaryCount() -- return shopping cart items summary (suppose you add sku1 6 qty and sku2 3 qty = total 9 qty return)
You can use 1st function.
There is a config setting field under System > Configuration > Sales > Checkout > My Cart Link with two options: "Display number of items in cart" and "Display item quantities". Choose the second option and your displaying issue will be solved.
Documentation here:
app\code\core\Mage\Checkout\Block\Cart\Minicart.php
Points to a config setting in Magento admin:
admin/system_config/edit/section/checkout/
My cart link
For edge cases you may need to loop through the cart and quantify as desired yourself.

opencart category quantity discount

I want to set discount is as follows.
Suppose, My one product is for £4.29.
If buyer buys 3 or in multiple of 3 like 3,54,39 or 189 etc, will cost him as £3.33/product.
If buyer buys bulk order other than multiple of three like 4 or 14 or 2 or 38 etc, than it will cost him as regular price of £4.29/product.
* One product will cost £3.33 only and only if bulk order is made with multiple quantity of 3. *
I found some setting in the discount section of each product. It works fine as per my requirement. (reffer attached image)
![enter image description here][1]
But it's hard to mention it for each multiple of 3. For Eg. What if a customer wants to 300 products. For that I need to write till the 300.
Is there any extension available for this or any one have other solution for this problem.
Thank you for your answer.
If am getting you right, you are able to calculate discount for all other quantities except for those in multiples of 3.
If that is the case, my suggestion is:
qty;
if ((qty % 3) == 0) {
// multiply qty by 3.33
price = qty * 3.33;
}
else {
// use your existing (working) formula
}
I hope this works.
twist added into the problem.
There are three categories with same price. Assume that its £4.29.
If a customer buys any of these category product with a total quantity of 3 or multiple of 3 than one product price will be £3.33
If a customer buys 10 products than 9 products will cost him as £3.33/product and remaining 1 product will cost £4.29.
Customer is allowed to buy 3 diffrent products of three different categories or he may buy 2 from one category or 1 from another category.
I hope you guys will understand the problem and give the bestest solution possible.

magento product qty as radio buttons

I am building a magento store that has a virtual product.
I would like to add radio buttons for some set product quantities. For example have 4 options on the page for 5 Qty, 10 Qty, 15 Qty and 20 Qty.
Then under this have an option to manually enter the qty.

Categories