Support » Plugin: Woocommerce Ajax add to cart for variable products » Not working for variable products with “Any” option

  • Hi!

    I’m trying to make it work with Variable product which have that “Any <attribute>…” option set in the product edit page, under the Variations tab. When I have it set, the product is not being added to the cart. When I change it to the actual variation options, it works.

    I don’t have it online, only locally for now, if I had I’d be happy to share a URL with you. Let me know if need help setting this up for debugging. I’m using all default woocommerce templates in my theme.

    Also, because of this, it’s throwing an error:

    PHP Fatal error: Uncaught Error: Using $this when not in object context in <...> woocommerce-ajax-add-to-cart-for-variable-products/woocommerce-ajax-add-to-cart-variable-products.php on line 157

    Thanks for the help!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter Guilherme Vaz

    (@gbvaz)

    Btw, I have the lasted version going (2.1) you just published. Thx!

    Plugin Author rcreators

    (@rcreators)

    Hello Guilherme,

    I didn’t get the first paragraph you wrote. It just went above my head in attribute and variation. So it will be great if you can provide url to check and if can explain better with url.

    Another point, i am not getting the PHP error on my side. I got it reported by other 2 user as well. But i am not sure how to solve it as its not generating on my side. Can you give me more details for it like PHP version, WP Version, WC Version and WC AJax plugin version. So i can replicate environment and see if that generates or i am going to need access to your test website for debug as well.

    Regards,
    Rishi Mehta

    Thread Starter Guilherme Vaz

    (@gbvaz)

    Hey Rishi,

    Thanks for the super quick reply!

    Yes, I understand this part is confusing, it’s not only hard to explain, but it’s also pretty difficult to find any information on this in Woocommerce documentation, or other support topics.

    This is what I’m talking about:
    https://pasteboard.co/JGq0n63.png

    With this option enabled, it’s like a shortcut, so shop managers won’t have to add each and every variation that have the same price and info. This is pretty handy when you have more than one attribute and as a result you’d get hundreds of variations, with this option, you can decrease the number of variation rows in product edit to a minimal more manageable amount.

    About the error, since it’s in the else bit of the if/else statement, I’m assuming you’re not getting it because you’re not falling into that else, try to force it to pass there, and see if throws?

    This is my environment information:
    PHP 7.4.9
    WP 5.5.1
    Woo 4.6.2
    WC Ajax 2.1

    Thanks again!

    Plugin Author rcreators

    (@rcreators)

    Hello,

    Ok. I got the Any Option point and i found its not working with ajax. Checking on it and let you know. Will check on PHP error as well. I think i am using php 7.3. Will check with 7.4 and let you know.

    Regards,
    Rishi Mehta

    Thread Starter Guilherme Vaz

    (@gbvaz)

    Ok, awesome! Thanks!

    About the php error, I’ve checked with older php version, 5.6 and it throws the same error, I guess it’s related to wp not php, but that’s just my guess.

    Thanks again,

    Guilherme

    Plugin Author rcreators

    (@rcreators)

    Hello Guilherme,

    Thanks for the quick replay. I was able to find both issue and able to solve them. Please update the plugin and it will work.

    Please give rating and review to plugin as well.

    Regards,
    Rishi Mehta

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Not working for variable products with “Any” option’ is closed to new replies.