woocommerce different prices based in weight - php

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.

Related

How to make Qty Attribute for Woocommerce

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)

How to overwrite custom weight for particular product in woocommerce?

I have custom product which is linked to woocommerce products list. I have to add custom weight for that product. I would like to add custom field for particular product in the backend and pull those values in the front end for shipping calculation
For example:
I have template sizes 8*8 = 1KG, 12*12 = 21kg,.... like that i have to add multiple template sizes and i have to show when user selected and 8*8 means the product should pull weight from the backend particular weight. there will not be any additional price for select template sizes
Please advise on this.

How to Add Dynamic Price in Magento for Vegetables

How to add dynamic pricing in magento when we select the available quantity from the drop down menu.
here is an Example
So, by default what i want is that it should display the price of 1 kg and then when we select other options from the quantity it will alter the prices.
So, by default it must show the price of 1 kg and then when modify it will show the altered prices.
Follow the example above.
For this you can create a custom option for that product with dropdown type and provide the price for each value.
Hope this will help.

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.

How to create a coupon on specific product in Magento?

Let's say I have 10% off coupon code.
This coupon is applicable only to Product B
A customer have in its cart :
Product P1
Product B
Product P2
I don't want my 10% off coupon apply to other product but only to Product B.
Do you know how I can do that within Magento?
Here is the process to create Coupon Code for any particular product:-
Login to Admin
Go to Promotions -> Shopping Cart Price Rules
Click Add New Rule
Fill Rule Information
Set Conditions
On left sidebar, click Conditions tab
Click + button icon
Select Product attribute combination
Click + button icon
Select SKU
Now, you will see SKU is ...
Put your product SKU over there
Please note that the SKU option may not show up by default. (Go to: catalog -> attributes -> manage attributes. Then search for the ‘SKU’ attribute and set the drop down ‘Use for Promo Rule Conditions’ to YES and reindex if needed.)
Set Actions
You can set how much discount you want to give from here
Save Rule
Also as extra information, if you not found SKU in promotion tab you can do following.
Go to: catalog -> attributes -> manage attributes
Search for the ‘SKU’ attribute and set the drop down ‘Use for Promo Rule Conditions’ on YES.
That will solve the problem.
They are not exact answer for the question.
Most of all the right but you have to setup one more thing as below if you want to discount only specific items or specific items in category.
Do it as above
under Shopping Cart Price Rule
Go to Conditions > Remove all conditions
Go to Actions and setup under
"Apply the rule only to cart items matching the following conditions (leave blank for all items)"
If you want to discount specific items, select SKU and input the SKU #
If you want to discount Category items, select category
It will be discounted only setup items even if other items are in the cart.
Go to your shopping cart rules in Admin Panel of Magento. When you create new rule, under conditions tab you have great options to set.
For example you can that this rule will apply only to products of a one category, or product which has defined attribute.
You should check those option, because Magento has many possibilities here.
Login to Admin
Go to Promotions -> Shopping Cart Price Rules
Click Add New Rule
Fill Rule Information
Under Actions :
In Apply the rule only to cart items matching the following conditions (leave blank for all items)
Click on + button, under that select SKU
Now, you can see SKU is ...
Put your product SKU over there
The SKU option wont be there in default, to add that
Catalog -> attributes -> manage attributes
Find SKU
Set "Use for Promo Rule Conditions" to Yes

Categories