woocommerce-product-bundles-bulk-discounts | Bulk discounts and dynamic pricing rules | Plugin library
kandi X-RAY | woocommerce-product-bundles-bulk-discounts Summary
kandi X-RAY | woocommerce-product-bundles-bulk-discounts Summary
Bulk discounts and dynamic pricing rules for WooCommerce Product Bundles.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Encode discount data .
- Load plugin .
- Calculate the discount items for a bundle .
- Get bundled cart item discount
- Adds discount data to the bundle .
- Bundle item discount
- Filter price .
- Import bulk discounts .
- Get the discount
- Decode the discount data array
woocommerce-product-bundles-bulk-discounts Key Features
woocommerce-product-bundles-bulk-discounts Examples and Code Snippets
Community Discussions
Trending Discussions on woocommerce-product-bundles-bulk-discounts
QUESTION
I am trying to change the cart content based on the quantity of a product in the cart. I only have 5 products in the shop:
- Product_1 => 1 panel,
- Product_2 => 12 panels,
- Product_3 => 18 panels,
- Product_4 => 30 panels,
- Product_5 => 60 panels,
They are configured as different products, so no bundles, kits or anything. More than one panel products are obviously cheaper than adding a number of single panels separately.
Then I have also a custom product that calculates the number of panels needed based on floor measures given by the customer and then adds to cart the necessary quantity of single panels.
I Would like to change dynamically the content of the cart when it's reviewed.
So for example, if the floor configurator calculate 54 single panels and added them to the cart, I would like to change the cart item to:
- 1 Product_4 (30 panels)
- 1 Product_2 (12 panels)
- 2 Product_1 (1 panel)
- and print a message stating the change.
I've checked different solutions but none of them offer this kind of feature:
- How to bundle products with WooCommerce
- WooCommerce Product Bundles - Bulk Discounts
- WooCommerce Dynamic Pricing & Discounts
So, based on this answer thread, I think I need to use hook woocommerce_before_calculate_totals
and implement the logic, but need some help since I am a wordpress dev noob.
Note that the add to cart button is called with Ajax in the floor configurator with:
...ANSWER
Answered 2018-May-22 at 18:59The code bellow should do the trick, It will replace the custom product (quantity) by your other products. You will have to set your custom product ID, your 5 normal product IDs and your custom text notice.
The code:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install woocommerce-product-bundles-bulk-discounts
PHP requires the Visual C runtime (CRT). The Microsoft Visual C++ Redistributable for Visual Studio 2019 is suitable for all these PHP versions, see visualstudio.microsoft.com. You MUST download the x86 CRT for PHP x86 builds and the x64 CRT for PHP x64 builds. The CRT installer supports the /quiet and /norestart command-line switches, so you can also script it.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page