Skip to content

Instantly share code, notes, and snippets.

@alexv66
Last active January 30, 2023 05:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexv66/7b0a6bf318e866d757db2b0bef7faa5f to your computer and use it in GitHub Desktop.
Save alexv66/7b0a6bf318e866d757db2b0bef7faa5f to your computer and use it in GitHub Desktop.
// $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