This file contains hidden or 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
/** | |
* TEMP FIX: Make switch prorations base off the subscription's recurring price, | |
* not the previous switch order total (affects consecutive same-cycle upgrades). | |
*/ | |
add_filter( 'wcs_switch_total_paid_for_current_period', function( $total_paid, $subscription, $existing_item ) { | |
// Get the product being switched from | |
$product = $existing_item && is_callable( [$existing_item, 'get_product'] ) ? $existing_item->get_product() : null; | |
if ( ! $product ) { |