• Resolved Zefrem23

    (@zefrem23)


    Hi, I’m using your plugin to give store credit to people who prepay for a table booking, as the prepayment is actually a minimum payment for a table at my clients’ nightclub. They must then be able to use the store credit to buy drinks and snacks for the table, to be served on their visit. But they mustn’t be able to pay for additional bookings with store credit, as this can result in an infinite money loop. So is there a way to prevent the “apply store credit” option from appearing based on the category of items in the cart? I’m comfortable using WordPress hooks and intermediate level PHP if this isn’t a straightforward setting somewhere.

Viewing 1 replies (of 1 total)
  • Plugin Support Jeff Alvarez

    (@superlemon1998)

    Hi @zefrem23,

    It’s currently not possible to exclude certain products from the store credits(deduct total $ value from excluded product in usable store credits) but it is possible to stop store credits(entirely) when a certain product is in the cart

    Add the following to your child theme’s functions.php or through the WP Code plugin. To use the snippet simply update the restricted product categories

    /**
     * Disallow store credits in certain categories
     */
    add_filter('acfw_is_allow_store_credits', function($value) {
    
        // check if cart has subscription product
        $cart = WC()->cart->get_cart_contents();
    
        foreach ( $cart as $cart_item ) {
            $product = $cart_item['data'];
    		$prodCat = $product->get_category_ids();       
    		
    		foreach($prodCat as $cat){
    			// Add product category ID here, you may extend it by using ||
    			if($cat === 39 || $cat === 40){
    				return false;
    			}
    		}
    
        }
    
        return $value;
    });

    • This reply was modified 11 months, 3 weeks ago by Jeff Alvarez.
Viewing 1 replies (of 1 total)
  • The topic ‘Store Credit limit to only certain categories’ is closed to new replies.