Home / Admin / Disallow point redemption if cart has subscription product.
Duplicate Snippet

Embed Snippet on Your Site

Disallow point redemption if cart has subscription product.

This snippet will remove the point redemption option if the cart has a subscription product

Code Preview
php
<?php
/**
 * Disallow point redemption if cart has subscription product.
 */
add_filter('lpfw_checkout_show_redeem_form', function($value) {
 
    // check if cart has subscription product
    $cart = WC()->cart->get_cart_contents();
 
    foreach ( $cart as $cart_item ) {
        $product = $cart_item['data'];
 
        // disallow store credits if cart has subscription product.
        if ( $product->is_type( 'subscription' ) || $product->is_type( 'subscription_variation' ) ) {
            return false;
        }
    }
 
    return $value;
});

Comments

Add a Comment