Last active
January 30, 2023 05:14
-
-
Save alexv66/7b0a6bf318e866d757db2b0bef7faa5f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// $product - WC_Product | |
// $qty - pass huge amount to see lowest prcie for bulk | |
function adpGetMinBulkPriceOfProduct($product, $qty) | |
{ | |
$processedProduct = adp_functions()->calculateProduct($product, $qty); | |
if ($processedProduct instanceof \ADP\BaseVersion\Includes\PriceDisplay\ProcessedProductSimple) { | |
return $processedProduct->getMinDiscountRangePrice(); | |
} else { | |
if ($processedProduct instanceof \ADP\BaseVersion\Includes\PriceDisplay\ProcessedVariableProduct) { | |
return $processedProduct->getLowestRangeDiscountPriceProduct()->getMinDiscountRangePrice(); | |
} | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment