You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should be able to use the pmpro_discount_code_level filter on applydiscountcode.php only to calculate the returned level cost based on all of the levels in $pmpro_checkout_levels:
i.e.
function pmprommpu_pmpro_discount_code_level( $code_level, $discount_code_id ) {
// Make sure this is being called by applydiscountcode.php
// Calculate level based on all levels
// Check for all levels in $pmpro_checkout_levels or rebuild array from $_REQUEST
// Sum applied level initial_payments, billing_amounts
// Return level
}
add_action( 'pmpro_discount_code_level' , 'pmprommpu_pmpro_discount_code_level', 10, 2);
or we could update applydiscountcode.php to handle multiple levels.
This makes sense. We also need to make sure the call to pmpro_checkDiscountCode() checks if a code works for ANY of the supplied levels instead of just one. The function itself takes one level id as a param. So we'd have to add a filter there and filter it... or we can sometimes update things in core to make them handle a single level or multiple.
The applydiscountcode.php service would be changed or have a filter added to allow us to instead of checking just the one level call pmpro_checkDiscountCode for all levels... something like that
When a discount code is applied on the checkout page via AJAX, only the discount code level for the "main" level ID is displayed. This is because applydiscountcode.php only handles the "main" level ID: https://github.com/strangerstudios/paid-memberships-pro/blob/dev/services/applydiscountcode.php#L26
We should be able to use the pmpro_discount_code_level filter on applydiscountcode.php only to calculate the returned level cost based on all of the levels in $pmpro_checkout_levels:
i.e.
or we could update applydiscountcode.php to handle multiple levels.
Support Ticket (Moderators Only)
https://www.paidmembershipspro.com/forums/topic/discount-code-not-summing-when-selecting-multiple-items/
The text was updated successfully, but these errors were encountered: