A
A
Alexander2016-02-08 17:54:27
WordPress
Alexander, 2016-02-08 17:54:27

Adding only one item to woocmmrce cart?

Hello! How can I make it so that only one item can be added to the cart, and if there is already a product in the cart, it was impossible to add another one?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
eisenheim94, 2016-02-11
@eisenheim94

/**
 * @desc Remove in all product type
 */
function wc_remove_all_quantity_fields( $return, $product ) {
    return true;
}
add_filter( 'woocommerce_is_sold_individually', 'wc_remove_all_quantity_fields', 10, 2 );

Googling would be faster. In general, you can set it in the admin panel

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question