• Resolved frolovsite

    (@frolovsite)


    Please tell me how to disable attribute validation when adding a product to the cart from the archive page.

    In other words, if I have two rows of variations in the product settings (see screenshot), where attributes are selected for the first row and not selected for the second row, then when I try to add such a product to the cart from the archive page, I will be redirected to the product page and will display something like this notification “Variations 2 must be completed”.

    It is worth saying that when adding such a product to the cart from the product page, the product is added to the cart without any problems. Whether your plugin is enabled or not.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Condless

    (@condless)

    Hi,
    The plugin can’t handle such case.
    You can hide the variation selection for this product on archive page:

    add_filter( 'upw_archive_variations', 'wc_disable_product_variation_shop_page', 10, 2 );
    function wc_disable_product_variation_shop_page( $enabled, $product ) {
    	$disabled_products = [ '432', '622' ]; // Update the products id
    	return in_array( $product->get_id(), $disabled_products ) ? false : $enabled;
    }
    Thread Starter frolovsite

    (@frolovsite)

    Unfortunately, this is not the solution that could satisfy me.
    Please answer honestly, is it really impossible to implement such a functionality, or in your opinion is it simply impractical? Because I have been looking for the reason for this behavior for a couple of days, but so far without success. Is it worth spending more time on this?

    Plugin Author Condless

    (@condless)

    Hi,
    It will require to develop few functions from scratch (such as ‘wc_ajax_add_to_cart’, ‘wc_variable_set_item_quantity’, ‘wc_variable_set_item_quantity_js’).

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Disable attribute validation when adding a product to the cart from the archive’ is closed to new replies.