Top WooCommerce & WordPress Plugins › Forums › Order Minimum/Maximum Amount for WooCommerce › How can I exclude products from limits that are available at 0?
- Support forum for the Order Minimum/Maximum Amount for WooCommerce.
- This topic has 3 replies, 2 voices, and was last updated 2 years, 5 months ago by
Zohaib.
- AuthorPosts
- June 13, 2021 at 5:29 pm #93048
Angelo
Guesthi, 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?
June 14, 2021 at 10:05 am #93049Zohaib
ParticipantHi,
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.
June 14, 2021 at 10:32 am #93050Angelo
Guestthanks, 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.
June 17, 2021 at 10:55 am #93051Zohaib
ParticipantHi 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 );
- AuthorPosts
- You must be logged in to reply to this topic.