PluginProbe
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO / 1.4.17
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO v1.4.17
1.4.17 1.4.16 1.4.15 1.4.14 1.4.13 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 1.4.6 1.4.5 1.4.4 1.4.3 1.4.2 1.4.1 1.4.0 1.3.54 1.3.53 1.3.52 1.3.51 1.3.50 1.3.49 1.3.48 All 180 releases
← All changes | functions/bogo.php +9 -4 1.4.61.4.17 View file →
@@ -412,10 +412,15 @@
412 412 if ( ! function_exists( 'disco_apply_category_bogo_paid_ratio' ) ) {
413 413 /**
414 414 * Scale a partly-free cart line's price down to its paid units.
415 415 *
416 - * Runs after Disco's own product price filters (priority 999), so the free
417 - * units are removed from whatever price the other campaigns resolved.
416 + * Runs after Disco's own product price filters, so the free units are
417 + * removed from whatever price the other campaigns resolved. Those filters
418 + * sit at PHP_INT_MAX, so this one shares that priority and relies on
419 + * registration order: bogo.php is required after product.php, and WordPress
420 + * runs same-priority callbacks in the order they were added. Registering
421 + * lower would put this first, and disco_discounted_price would then re-read
422 + * the base price and discard the scaling.
418 423 *
419 424 * @param float|string $price Product price.
420 425 * @param \WC_Product $product Product object.
421 426 * @return float|string
@@ -434,10 +439,10 @@
434 439
435 440 return (float) $price * $ratios[ $object_id ];
436 441 }
437 442
438 - add_filter( 'woocommerce_product_get_price', 'disco_apply_category_bogo_paid_ratio', 1000, 2 );
439 - add_filter( 'woocommerce_product_variation_get_price', 'disco_apply_category_bogo_paid_ratio', 1000, 2 );
443 + add_filter( 'woocommerce_product_get_price', 'disco_apply_category_bogo_paid_ratio', PHP_INT_MAX, 2 );
444 + add_filter( 'woocommerce_product_variation_get_price', 'disco_apply_category_bogo_paid_ratio', PHP_INT_MAX, 2 );
440 445 }
441 446
442 447 if ( ! function_exists( 'disco_free_product_label' ) ) {
443 448 /**