mycred-woocommerce.php – $woocommerce->cart object is not always available

front page Forums Community mycred-woocommerce.php – $woocommerce->cart object is not always available

This topic contains 0 replies, has 1 voice, and was last updated by Avatar mattiasrefinemarketing 6 months, 2 weeks ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #35430
    Avatar
    mattiasrefinemarketing

    Hi,

    I get a
    PHP Notice: Trying to get property ‘total’ of non-object in /home/refine12/public_html/dev.pilatesvia.com/se/wp-content/plugins/mycred/addons/gateway/carts/mycred-woocommerce.php on line 556

    because occasionally the $woocommerce->cart is not always set when the hook ‘mycred_woo_available_gateways’ is triggered.

    I would love to see a test added to make sure before using $woocommmerce->cart object on this line.

    $cost = $mycred->apply_exchange_rate( $woocommerce->cart->total, $gateways[‘mycred’]->get_option( ‘exchange_rate’ ) );

    Cheers,

    /Mattias

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

11