I’m selling hand-painted artwork on a WooCommerce store. Since It’s hand-painted artwork,
The product quantity is limited to 1 (Limit purchases to 1 item per order)
I have created product variations for the artwork frame as below :
Variation 1: Wooden Frame (stock qty = 1 in variations)
Variation 2: acrylic Frame (stock qty = 1 in variations)
I want to limit the order to per product/per variations basis.
Example: A User can purchase an artwork with either a wooden or acrylic frame only.
Currently, A user can add to cart artwork with both wooden & acrylic frames.
I don’t want a user to purchase a unique hand-made artwork with 2 separate variations.
How can I achieve this ? Is there any function that can be used to limit this?
2
Answers
Here is the code that worked for me.
Please check below global code:
Also, if you have to make it for some products then you can create a custom field in the product and enable it. Then use that custom code in the front-side and do validate in the cart validation and it will perform with your defined products.
Please let me know if you find any issues.