I have subscriptions applied to most all products on my website. My issue is, when an item goes on sale, the subscription price is based off the sale price at checkout instead of the regular price. With the amount of discount they receive, I don't want the ongoing subscription to be based off the sale price but the original price. Is there a way to disable the price of the woo discount rule sale when they choose the subscription at the cart or checkout page? I have this code that works for the coupons, but not for woo discount rules. does anyone know how to recreate for that plugin?
/******************************************
disable coupon code for subscription product
*******************************************/
function remove_store_credit( $subscription ) {
// Loop through order coupon items
foreach ( $subscription->get_items( 'coupon' ) as $item ) {
$coupon = new WC_Coupon( $item->get_code() ); // get an instance of the WC_Coupon Object
if( $coupon->get_discount_type() == "smart_coupon" ){
$subscription->remove_coupon( $item->get_code() );
}
}
}
add_action('woocommerce_subscription_payment_complete', 'remove_store_credit', 10, 1);