• Resolved david127

    (@david127)


    Hi,

    First of all thanks for a great plugin. There are some issues I came across:

    1.) When adding a product, which has a limited stock of e.g. 1 to your basket and you already have it in your basket, WC will return an error (“You cannot add that amount to the cart — we have 1 in stock and you already have 1 in your cart.“). However, your plugin is not handling this error well and instead throwing the following PHP error:

    PHP Fatal error: Using $this when not in object context in /home/kossmos/htdocs/shopclay.test/public_html/wp-content/plugins/woocommerce-ajax-add-to-cart-for-variable-products/woocommerce-ajax-add-to-cart-variable-products.php on line 124

    Changing the PHP code like below resolved this error:

    //$this->json_headers();
    header('Content-Type: application/json');

    2.) I was wondering if we could return the error in the JSON response, so the page does not have to reload to show it?

    3.) Also as mentioned in an earlier issue, woocommerce_params.ajax_loader_url is (sometimes) undefined?

    4.) In the JS file I guess you should replace line 126
    $(key).html(value);
    with:
    $(key).replaceWith(value);

    https://wordpress.org/plugins/woocommerce-ajax-add-to-cart-for-variable-products/

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

    (@rcreators)

    Hi David,

    Thanks for the report. will update this weekend for same.

    Did you ever update this? I’m getting this error for $this->get_refreshed_fragments();

    Any idea?

    Plugin Author Rishi Mehta

    (@rcreators)

    Hi rookpsu,

    Can you create new request for issue ? also if possible provide me link to check. This issue you telling is never come up before.

    Please create separate ticket for your issue and provide development url. Will try to resolve it asap.

    Thanks,
    Rcreators

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Using $this when not in object context’ is closed to new replies.