cart; if ( ! $cart ) { return $recalculate; } $coupons = $cart->get_coupons(); if ( empty( $coupons ) ) { return $recalculate; } foreach ( $coupons as $coupon ) { if ( get_post_meta( $coupon->get_id(), '_disable_tiered_pricing', true ) === 'yes' ) { return false; } } return $recalculate; } public function saveTieredPricingOption( $couponId ) { update_post_meta( $couponId, '_disable_tiered_pricing', isset( $_REQUEST['_disable_tiered_pricing'] ) ? 'yes' : 'no' ); } public function addTieredPricingOption( $couponId, $coupon ) { woocommerce_wp_checkbox( array( 'id' => '_disable_tiered_pricing', 'label' => __( 'Disable tiered pricing when the coupon is applied', 'woocommerce' ), 'description' => __( 'Check this option to don\'t apply tiered pricing in the cart when users have applied this coupon.', 'tier-pricing-table' ), 'value' => get_post_meta( $couponId, '_disable_tiered_pricing', true ), ) ); } public function getDescription() { return __( 'Allows you to manage which coupons will allow tiered pricing and which ones will not.', 'tier-pricing-table' ); } public function getSlug() { return 'coupons'; } }