Support » Plugin: Advanced Shipping Validation for WooCommerce » Extend validation to Shopping Cart

  • I’m on WP 4.8 & WooCommerce 3.0.8, and your plugin works great!
    Since the validation runs in the Checkout page, is there any way to extend the validation to the Shopping Cart page?

    Please advise. Thank you.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Jeroen Sormani

    (@sormano)

    Hi Jason,

    At this moment there’s no way in the plugin to run the validation rules at the cart. There would (could) be some conflicts such as address fields that aren’t set yet on the cart page.

    It might be possible with some custom code to accomplish this, but I haven’t tested / done that before.

    Cheers,
    Jeroen

    G’day Jeroen,

    It’ll be great to insert a couple of snippets into functions.php to get your plugin working in the Shopping Cart page.

    I need 2 condition validations.
    Firstly, to check the cart contents for at least one parent category.
    And secondly, to check the cart contents for another category against the shipping state.

    Please advise. Thank you in advance.

    Plugin Author Jeroen Sormani

    (@sormano)

    Hi Jason,

    You may want to check the Advanced Messages plugin of mine; this would allow you to add messages to the cart, though it wouldn’t stop people from entering the checkout.

    Otherwise I’d advise to hire a developer to help with your specific requirements.

    Hope that helps!

    Have a great day!
    Jeroen Sormani

    I found in “/includes/wcasv-validation-functions.php” on line 118, with this line of code.

    add_action( 'woocommerce_after_checkout_validation', 'wcasv_add_checkout_validation_messages' );

    Is it possible to add this additional code?

    add_action( 'woocommerce_add_to_cart_validation', 'wcasv_add_checkout_validation_messages' );

    Plugin Author Jeroen Sormani

    (@sormano)

    Hi Jason,

    That would probably be when someone tries to add a product to the cart, and not in the cart itself. Also, I don’t think the notice created in that function will stop the validation, the ‘woocommerce_add_to_cart_validation’ is a filter and not a action, requiring a ‘return false’ to stop the validation.

    It is close though, maybe your webdeveloper can help you customize it a bit to fit your exact requirements 😉

    Cheers,
    Jeroen

    If that’s the case, then I’ll add the snippet from

    https://gist.github.com/bekarice/1883b7e678ec89cc8f4d of

    Oops! Wrong link.

    This is the correct one ~ https://gist.github.com/bekarice/99d479e6c91880b3b80a21a0b3415b7f

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.