Magento: Complex Pricing Based on Quantity and Color Options
Hello everyone! Today, we’re going to tackle a complex pricing scenario for an e-commerce store built using Magento. Our client, a dummy print company, needs to sell business cards with multiple levels of quality and quantity options, each with varying color configurations.
The Challenge: Two-level Pricing Based on Quantity and Color
The store offers four types of business cards (Standard, Premium, Superior, Luxury) and four pre-set quantities (500, 1000, 2000, 3000). However, the pricing isn’t straightforward. It depends on both the quantity selected AND the number of colors chosen for the design.
Let’s look at an example to clarify this:
Standard Business Card Pricing:
-
Quantity Set: 500
-
Colors:
- 1 Color: $24.99
- 2 Colors: $39.99
- 3 Colors: $54.99
-
Quantity Set: 1000
-
Colors:
- 1 Color: $22.99
- 2 Colors: $37.49
- 3 Colors: $51.99
And so on for the other quantity sets and card types.
As you can see, the price varies based on a two-level hierarchyâfirst by the quantity set chosen, then by the number of colors selected within that set.
Solving the Magento Pricing Dilemma
To implement this pricing structure in Magento, we’ll need to create multiple price tiers for each product. Here’s how you can approach it:
-
Create a new attribute for “Quantity Set”: Since Magento doesn’t have a built-in field for selecting pre-set quantities, you’ll need to create a custom dropdown attribute under the ‘Properties’ section of your product.
-
Use Magento’s tier pricing system: Go to the ‘Prices’ tab in your product edit page and click on “Add Tier Price.” Here, you can set the price based on the quantity selected by the customer.
- Set the Qty from 1000 (or any minimum) and enter the corresponding prices for each number of colors.
- Repeat this process for every quantity set and color option.
-
Enable tier pricing display: In your Magento admin, navigate to System > Configuration > Catalog > Price Display Settings and enable “Use Tier Prices in Cart” and “Use Tier Prices in Product Listing.”
Code Example: Setting Up Tier Pricing
Here’s a simplified example of how you might set up the tier prices for one product:
$tierPrice = array(
array(
'website_id' => 0,
'customer_group_id' => 1,
'price_qty' => 500, // Qty Set: 500
'price' => array(
1 => 24.99, // Price for 1 color
2 => 39.99, // Price for 2 colors
3 => 54.99 // Price for 3 colors
)
),
array(...), // Set up tier pricing for Quantity Set: 1000
...
);
Conclusion
Implementing complex pricing structures like this in Magento requires a combination of custom attributes, tier pricing configuration, and careful attention to detail. By following the steps outlined above, you should be able to create an e-commerce store that offers dynamic pricing based on both quantity sets and color options.
Remember, the key is to leverage Magento’s built-in featuresâa bit of creative configuration can go a long way in handling complex pricing scenarios.
For more detailed guides on Magento customization and optimization, check out our blog at Laravel Company. We regularly publish practical tutorials and best practices for Magento development.