WooCommerce – Ignore unselected variations when adding to cart

Objective: add product to cart despite unselected variations, i.e. remove/disable the mandatory nature of variation fields.

Issue: WooCommerce’s absolute requirement for all variations to be selected before adding to cart.

Tried: filtering out/removing/disabling unselected variations before adding to cart using various hooks; woocommerce_before_calculate_totals, woocommerce_add_to_cart, woocommerce_add_cart_item, woocommerce_add_to_cart_validation

I understand that this is how WooCommerce works and the reasons why it works this way – despite this I still require a work-around.

How do I get around WooCommerce’s "all variations selected" requirement so that I may still add a product to the cart even if not all variations are selected?

Source: Ask PHP

LEAVE A COMMENT