• Resolved Gal Baras

    (@galbaras)


    After adding a product with a minimum of 4 to the cart, it’s possible to reduce the quantity using the standard WooCommerce mini-cart block.

    This should not be possible, but it seems that the mini-cart block doesn’t apply the same filters as the cart page/shortcode.

    Please fix.

    See also https://github.com/woocommerce/woocommerce-blocks/issues/11422

    • This topic was modified 1 year, 1 month ago by Gal Baras. Reason: Added GitHub issue reference

    The page I need help with: [log in to see the link]

Viewing 6 replies - 16 through 21 (of 21 total)
  • Plugin Author Saiful Islam

    (@codersaiful)

    Hello @galbaras Yesterday, I provided that code on your thread on Github. Actually yesterday I got solution, Today I will apply on my plugin.

    I just informed you over your thread.

    Thanks a lot.
    After submit my plugin with that solution, I will inform you.
    Thanks again.

    Plugin Author Saiful Islam

    (@codersaiful)

    I have updated plugin code and fixed following:

    = 6.0 =
    * Fixed: min,max and step on WooCommerce Minicart Block issue has been fixed.
    * Fixed: Min,Max,Step issue on WooCommerce Cart Block has been fixed
    * Fixed: Min,Max,Step issue on WooCommerce Checkout Block has been fixed

    Update your plugin please and let us know please.
    Thanks
    Saiful
    CEO and Founder of CodeAstrology

    Thread Starter Gal Baras

    (@galbaras)

    I didn’t realise who you were. Well done and thank you.

    The plugin now seems to cause the max attribute to be set to 0, and this disables the numeric functions in the mini cart. You can test this here (after adding something to the cart first).

    The cart shortcode is still OK, but the cart block causes a server error with this stack trace:

    [25-Jan-2024 07:25:57 UTC] PHP Fatal error:  Uncaught TypeError: Automattic\WooCommerce\StoreApi\Utilities\QuantityLimits::limit_to_multiple(): Argument #1 ($number) must be of type int, string given, called in ROOT/wp-content/plugins/woocommerce/src/StoreApi/Utilities/QuantityLimits.php on line 59 and defined in ROOT/wp-content/plugins/woocommerce/src/StoreApi/Utilities/QuantityLimits.php:72
    Stack trace:
    #0 ROOT/wp-content/plugins/woocommerce/src/StoreApi/Utilities/QuantityLimits.php(59): Automattic\WooCommerce\StoreApi\Utilities\QuantityLimits->limit_to_multiple()
    #1 ROOT/wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ProductSchema.php(487): Automattic\WooCommerce\StoreApi\Utilities\QuantityLimits->get_add_to_cart_limits()
    #2 [internal function]: Automattic\WooCommerce\StoreApi\Schemas\V1\ProductSchema->get_item_response()
    #3 ROOT/wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AbstractProductGrid.php(113): array_map()
    #4 ROOT/wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AbstractBlock.php(88): Automattic\WooCommerce\Blocks\BlockTypes\AbstractProductGrid->render()
    #5 ROOT/wp-includes/class-wp-block.php(258): Automattic\WooCommerce\Blocks\BlockTypes\AbstractBlock->render_callback()
    #6 ROOT/wp-includes/class-wp-block.php(244): WP_Block->render()
    #7 ROOT/wp-includes/class-wp-block.php(244): WP_Block->render()
    #8 ROOT/wp-includes/blocks.php(1484): WP_Block->render()
    #9 ROOT/wp-includes/blocks.php(1522): render_block()
    #10 ROOT/wp-includes/class-wp-hook.php(324): do_blocks()
    #11 ROOT/wp-includes/plugin.php(205): WP_Hook->apply_filters()
    #12 ROOT/wp-includes/blocks/post-content.php(48): apply_filters()
    #13 ROOT/wp-includes/class-wp-block.php(258): render_block_core_post_content()
    #14 ROOT/wp-includes/class-wp-block.php(244): WP_Block->render()
    #15 ROOT/wp-includes/class-wp-block.php(244): WP_Block->render()
    #16 ROOT/wp-includes/blocks.php(1484): WP_Block->render()
    #17 ROOT/wp-includes/blocks.php(1522): render_block()
    #18 ROOT/wp-includes/block-template.php(260): do_blocks()
    #19 ROOT/wp-includes/template-canvas.php(12): get_the_block_template_html()
    #20 ROOT/wp-includes/template-loader.php(106): include('/home/gboldev/p...')
    #21 ROOT/wp-blog-header.php(19): require_once('/home/gboldev/p...')
    #22 ROOT/index.php(17): require('/home/gboldev/p...')
    #23 {main}
      thrown in ROOT/wp-content/plugins/woocommerce/src/StoreApi/Utilities/QuantityLimits.php on line 72
    Plugin Author Saiful Islam

    (@codersaiful)

    Hello @galbaras
    I have fixed that issue and finally solved that issue.
    Thanks a lot for informing me.

    By the way, I am the plugin Author.
    Thanks Again
    Saiful

    Thread Starter Gal Baras

    (@galbaras)

    Yep, all good now. Cheers!

    Plugin Author Saiful Islam

    (@codersaiful)

    Thanks a lot.

Viewing 6 replies - 16 through 21 (of 21 total)
  • The topic ‘Mini-cart not enforcing rules’ is closed to new replies.