• Hello

    I am php developer working on WPML plugin (https://wpml.org). We found your plugin is causing fatal error when installed alongside with ours.

    How to reproduce

    Setup WPML and WCML in 2 languages
    Enable multicurrency
    Install Partial.Ly plugin – available from the WP repository
    Make a rest request to: /wp-json/wc/v3/products
    Notice a fatal error as mentioned above

    The error is:
    > PHP Fatal error: Uncaught Error: Call to a member function get_cart() on null in …\woo-partially\inc\gateway.php:20

    The piece of code there is:

    
    // check for products in the cart with Partially disabled
      foreach (WC()->cart->get_cart() as $cart_item_key => $item) {
        if (get_post_meta( $item['product_id'], 'partially_disabled', true ) == 'yes') {
          $hasDisabled = true;
        }
      }
    

    The cart is not set indeed. Could you wrap this piece od code into that if, so it will not be executed during REST API calls?

    
    if ( null !== WC()->cart ) {
    // your code goes here
    }
    

Viewing 2 replies - 1 through 2 (of 2 total)
  • I can report that I’m seeing this same error on a site without WPML installed.

    PHP Fatal error: Uncaught Error: Call to a member function get_cart() on null in /home/nginx/domains/DOMAIN/public/wp-content/plugins/woo-partially/inc/gateway.php:20

    So it is likely not specifically a conflict with WPML.

    Whatever the case, I would also request the plug-in developer to implement a fix for this.

    Thank you.

    I’m experiencing the same issue also on a site without WPML installed.

    PHP Fatal error: Uncaught Error: Call to a member function get_cart() on null in …/public_html/wp-content/plugins/woo-partially/inc/gateway.php:20

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Fatal error when installed with WPML plugin’ is closed to new replies.