How can I exclude products from limits that are available at 0?

WPFactory Plugins – Empower Stores Success Forums Order Minimum/Maximum Amount for WooCommerce How can I exclude products from limits that are available at 0?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #93048
    Angelo
    Guest

    hi, I’m building the B2B for my E-commerce I have different needs:
    – Create a minimum order for each different user (and with your plugin I can do it)
    – Exclude a product from the minimum order count, but not a single product chosen manually but all products that are available at 0, having enabled the possibility of making backorders on my site.

    it’s possible to do it?

    #93049
    Zohaib
    Participant

    Hi,

    This should be possible if you can add products with no stock either to a category or add a tag to them.

    If they are tagged, for example, In the plugin’s settings, you will need to navigate to Cart Products tab and exclude products with that tag.

    I will forward your request to our plugin’s developers and they can advise if a tag can automatically be added to products that go out of stock.

    #93050
    Angelo
    Guest

    thanks, that’s exactly what I would like, automatically inserting a tag to the product as soon as it becomes available 0 would be perfect. I await your response to be able to purchase the plugin, thanks.

    #93051
    Zohaib
    Participant

    Hi Angelo,

    Here is the code that you can use to automatically add a tag to products that are out of stock:

    function my_action_woocommerce_no_stock( $product ) {
        // Set category ids
        $product->set_category_ids( array( 39, 2 ) );
    
        // Product set tag ids
        $product->set_tag_ids( array( 40 ) );
    
        // Save
        $product->save();
    }
    add_action( 'woocommerce_no_stock', 'my_action_woocommerce_no_stock', 10, 1 );
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.