• Resolved fixait

    (@fixait)


    Hi,

    Is it possible to disable display in cart and checkout for some products? Ideally products with a certain attributes? Using a hook?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Marin Matosevic

    (@marinmatosevic)

    Hi,

    Yes, you can use the fsl_min_amount filter hook to control the display. You need to check the products in the cart and return null if none of the products match your criteria.

    Below is a simplified version of how to achieve this:

    add_filter('fsl_min_amount', function ($amount) {
    if (!WC()->cart) {
    return;
    }

    // Define allowed attributes or other criteria for products.

    // Loop through each item in the cart.
    foreach (WC()->cart->get_cart() as $cart_item) {

    // Check if the product matches the allowed criteria.
    // If a product matches, set a flag or take necessary action.

    }

    // If no products match, set the amount to null.
    return $amount;
    });

    If null is returned by this filter, it will prevent the progress bar from being displayed on the cart and checkout pages.

    Plugin Author Marin Matosevic

    (@marinmatosevic)

    We haven’t heard back from you in a while, so I’m going to go ahead and mark this thread as resolved. If you have any other questions please feel free to start a new thread.

    Thread Starter fixait

    (@fixait)

    Hi,

    its work. Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.