• When it shows suggested products it show the sold out products.

    When you click add to cart sold out products get charged!

    I think that is something should be corrected. I do not want to hide sold out products from the shop page because they will be available again. But if i they are sold out I do not want them to be suggested.

Viewing 1 replies (of 1 total)
  • Plugin Author WPClever

    (@wpclever)

    Hi @eduardorelax

    Thanks for your rating and feedback!

    To exclude unpurchasable products from the suggested products, please add the below snippet (How to add custom code?):

    add_filter( 'woofc_suggested_products', 'woofc_suggested_products_exclude_unpurchasable' );
    function woofc_suggested_products_exclude_unpurchasable( $suggested_products ) {
    	foreach ( $suggested_products as $k => $suggested_product_id ) {
    		$suggested_product = wc_get_product( $suggested_product_id );
    
    		if ( ! $suggested_product || ! $suggested_product->is_in_stock() || ! $suggested_product->is_purchasable() ) {
    			unset( $suggested_products[ $k ] );
    		}
    	}
    
    	return $suggested_products;
    }
Viewing 1 replies (of 1 total)
  • The topic ‘I like it but it has a problem’ is closed to new replies.