Change order of dropdowns on single product page - php

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!

Related

How to display attributes SKUs and Description above Add to Cart button

I am using WordPress WooCommerce. I have a requirement to display SKU and Description of ATTRIBUTES above Add To Cart button on Product page.
Right now Description is above the button and SKU is below the button.
Current result
How can I display them above the button? Also, right now Description appears after selecting Product Variables, I want it to display all the time, just it can change upon changing selection.
Expected result
I checked in WooCommerce template files, there are different PHP files for displaying both SKUs and Attr Desc.

Woocommerce: Adding customizable product seperatly to cart

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.

Woocommerce Product Variations attributes

I have a Question regarding Product attributes.
Generally Products attributes display in a drop down, when you select attribute from the drop down it will show an add to cart button. This is the Woo-commerce default flow of attributes.
Now my question is that I don't like to display attributes in a select box. I would like to display as my layout.
For example, we have size attributes in Product and that will display in the select box, but I want to display in circle designs. I don't want to display as a drop down.
Yes you can do this. you can get all your product variations using
$product->get_available_variations() It'll return an array containing all your product variation data. When user selects an option woocommerce updating an input value with the selection. It's a hidden input in your source. You need to find that input field and update it's value. I normally use jquery for that.
Hope it'll help.
Thanks.

Magento - set default filter in layer

I need some help with the following issue. I use an attribute in the layered navigation which is connected to stock values. The attribute has two options - In stock and All products (which includes out of stock products as well).
Is there any way I can have the In stock option selected by default when an user enters a category page? This way users would view only products which are in stock, but if they want they can select all products and also view the others.
Thanks in advance,
Alex
I think you can check the url after selecting the attribute you want to show in default and pass that url when that category is clicked.
This can be the option.

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