Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Balakrishnan-flycart/d7b3156a9b88a2c0de3a72e60dbbc0db to your computer and use it in GitHub Desktop.
Save Balakrishnan-flycart/d7b3156a9b88a2c0de3a72e60dbbc0db to your computer and use it in GitHub Desktop.
Woo Discount Rules v2 - Compatible with WooCommerce Product Add-Ons Ultimate by Plugin Republic
add_filter('advanced_woo_discount_rules_discounted_price_of_cart_item', function($price, $cart_item, $cart_object, $calculated_cart_item_discount){
$add_on_price = 0;
if(isset($cart_item) && isset($cart_item['product_extras']) && !empty($cart_item['product_extras'])){
$price_with_extras = isset($cart_item['product_extras']['price_with_extras']) ? $cart_item['product_extras']['price_with_extras'] : 0;
$original_price = isset($cart_item['product_extras']['original_price']) ? $cart_item['product_extras']['original_price'] : 0;
$add_on_price = $price_with_extras - $original_price;
$price = $price + $add_on_price;
}
return $price;
}, 10, 4);
@fakharbj
Copy link

fakharbj commented Apr 24, 2024

I used woo discount rules and also used Woocommerce Product Add-Ons. I set discount as "Fixed price for set / bundle" and i don't get price of products addons product on cart and checkout. Only get fix discounted price.
I need compatibility with Woocommerce Product Add-Ons

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment