briteskies-knowledge-base

How to Set a Minimum Quantity in the Shopping Cart for a Configurable Product

Matt Trimmer
11/2015

The Problem

As much as I hate to admit it, there have been times where a client asks me how to do something in the Magneto admin, and I really just don’t know. Being a certified Magento Solution Specialist, I know my way around the Magento admin and can usually answer any and all questions. But recently, a client asked how to set the minimum quantity in the cart for a configurable product.

Thinking I knew how to complete this task, I went into the Magento admin, found the product in question, and went to update the Minimum Quantity Allowed in Shopping Cart attribute in the inventory tab. When I navigated to that location, the attribute wasn’t available. All I saw was Manage Stock, Enable QTY Increments, and Stock Availability.

Matt_blog_1.png

What I was expecting to find was a page similar to a simple product: Matt_blog_2.png

Here, the Minimum Quantity Allowed in Shopping Cart attribute allows the site manager to prevent users from checking out with too small of a quantity and displaying that number in the Quantity box on the front end. It’s a straight forward process with a simple product, so what am I missing for a configurable?

My first thought was to update the Minimum Quantity Allowed in Shopping Cart for all of the simple products. Maybe if they are all set the same, the configurable will know to pick it up. That got me halfway there; I was notified that there is a minimum quantity allowed, but I would prefer to show that to customers up front.

Matt_blog_3.png

Being out of ideas, I resorted to Googling my issue, but Google was less than helpful. All videos and tutorials only addressed updating a simple product. These tutorials didn’t even acknowledge that configurable products are a thing. Am I crazy, or was I the only person who ever came across this problem? Couldn’t be. So, I commented on some of the videos and I always got the same result: needs a module. Even StackExchange told me what I wanted was not achievable out of the box. But I am here to tell you that they were wrong. Here is how you set the Minimum Quantity in Cart for a configurable product.

Tutorial

Setting up the minimum quantity in the cart for a configurable product is a very different process than updating a simple product. We will need to leverage Magento’s Import/Export process to update product attribute fields that are not visible in the admin.

First, navigate to Magento’s Export function.

Select ‘Products’ as the Entity Type. After that, Magento will pull up all the attributes you can use to filter your export. If you leave this blank, Magento will export every single product in the catalog. We are just going to update one product, so for SKU we will put in our configurable item’s SKU. Hit ‘Continue’ and the export will process.

The export will have a lot of columns that are not relevant to us now. By removing all the columns except sku, min_sale_qty, and use_config_min_sale_qty, we only need to deal with the attributes we are worried about.

Matt_blog_4.pngFor our SKU, we need to update the min_sale_qty to be the minimum quantity we want to allow in the cart. For the sake of example, let’s say we want that number to be 10.

Now, it is important that we also update use_config_min_sale_qty. Currently, with a value of 1, this is set to use the configurable minimum quantity in cart value, no matter what value we put in. So, we need to replace that value with 0, to override the default.

Matt_blog_5.pngThe file is ready and just needs to be imported into Magento. Going back to the front end, we see that the minimum quantity in the cart now displays as 10 on our site.

Matt_blog_6.png

The Magento admin will still now display this attribute for a configurable product, but the value is still saved and updated through the import process.

Have you come across a tough Magento issue recently? Contact our team of certified developers for help. 

Read more about the key benefits of partnering with a company that uses  certified developers. Click to Download

A Great Offer, Just a Click Away

Lorem ipsum dolor sit amet, consectetur adipiscing elit

Subscribe by Email

Comments (4)