Closed procontentxyz closed 2 years ago
This feature is not currently provided. With the filter woocommerce_add_cart_item_data you can implement it yourself relatively easily. Just make sure to set the meta key 'wcdp_donation_amount' to your desired amount. Best, Jonas
Suppose I have two products product A and product B,
I want to limit minimum donation amount to 100 in product A,
And minimum donation amount 300 in product B.
How can I do this using your filters that you have provided me in last answer can you guide please
Any tutorial or documentation page for this
I'm a bit busy at the moment, so I can't write any individual code for you for the time being. What exactly are you failing at with the filter? (programming in php, how filter work, which values have to be set etc.)
i have a 5 products on my site.
i have set minimum donation amount to be: 200 for : 3 of 5 products.
i want to set minimum donation amount to be 500 for remaining 2 products.
how to set minimum OR maximum donation amount per product basis, not globally.
pelase guide big brother.
Haven't tried it, but based on this it shouldn't be too hard to implement it:
//filter cart item data, this data is used to update the product price later
add_filter( 'woocommerce_add_cart_item_data', function($cart_item_data, $product_id, $variation_id, $quantity) {
if ($product_id == 123 && $cart_item_data['wcdp_donation_amount'] < 200) {
//update amount
$cart_item_data['wcdp_donation_amount'] = 200;
}
return cart_item_data;
}, 10, 4 );
Could i set 'wcdp_donation_amount' meta using custom fields in product edit page?
Would it effect/override global setting?
I have a feeling that you have never bothered to try to understand what the filter is doing. There is no product metadata stored here, but meta data from the Cart object.
The plugin checks if the specified donation amount is within the min/max range and stores it in the cart meta data. You can use the filter to alter the amount.
Okk... Actually i am not a developer, i just try things
If its come as per need, i feel good
I have a use case, Where I need to set min & max donation amount per product (campaign) basis.
Currently your software provide it using global setting.
kindly address my use case.