Please submit a private ticket if you need to share sensitive information, such as license details and admin credentials.

Okay
  Public Ticket #2330711
Subscription and non subscription items errors at checkout
Closed

Comments

  • christopher tork started the conversation

    I am having a issue when a subscription item and non subscription items are sent to pay at paypal checkout

    If “Add separately” is checked it works fine.

    If “Add separately” is not checked then it throws an error when trying to submit to paypal.

    with 1 subscription and 2 non subscription items in cart.

    2020-03-18T07:11:50+00:00 CRITICAL Uncaught Error: Call to a member function get_stock_managed_by_id() on null in D:homesitewwwrootwp-contentpluginswoocommerceincludesclass-wc-cart.php:696
    Stack trace:
    #0 D:homesitewwwrootwp-contentpluginswoocommerceincludesclass-wc-cart.php(1072): WC_Cart->get_cart_item_quantities()
    #1 D:homesitewwwrootwp-contentpluginswpc-force-sellswpc-force-sells.php(970): WC_Cart->add_to_cart(297, 1, 0, Array, Array)
    #2 D:homesitewwwrootwp-includesclass-wp-hook.php(288): WPClever_Woofs->woofs_add_to_cart(‘eaeb346f8c27097…’, 242, 1, 0, Array, Array)
    #3 D:homesitewwwrootwp-includesclass-wp-hook.php(312): WP_Hook->apply_filters(”, Array)
    #4 D:homesitewwwrootwp-includesplugin.php(478): WP_Hook->do_action(Array)
    #5 D:homesitewwwrootwp-contentpluginswoocommerceincludesclass-wc-cart.php(1115): do_action(‘woocommerce_add…’, ‘eaeb346f8c27097…’, 242, 1, 0, Array, Array)
    #6 D:homesitewwwrootwp-contentpluginsyith-woocommerce-subscriptionincludesclass.yith-wc-subscription-or in D:homesitewwwrootwp-contentpluginswoocommerceincludesclass-wc-cart.php on line 696

  •  767
    Janilyn replied

    Hi Christopher, 

    Thank you for contacting WPClever Support Forum. We've received your ticket and assigned one of our developers to give some help. 

    Before that, could you please provide more details like a link to your site so that our developer can check directly on your site and find the cause faster? 

    Best regards.

    Janilyn T. - WPClever Support Agent

  • christopher tork replied

    I did some debugging and the issue is that it looks like woofs is adding a extra  "woofs_keys" to the cart items when it goes to checkout to paypal.  

    So when $this->get_cart()  and the cart loops through the array it finds "woofs_keys" and triess to get the product from it.
    $product = $values['data'];  <--- but $values['data'] is null since there is not 'data' item in "woofs_keys"

    I worked around it but adding a check to all the following likes below
    if (array_key_exists("data",$cart_item))

    lines #'s:

    wp-content/plugins/woocommerce/include/class-wc-cart.php  696,678,755,781,1387
    wp-content/plugins/woocommerce/include/class-wc-cart-totals.php  221
    wp-content\plugins\woocommerce\includes\class-wc-discounts.php on line 83
    wp-content\plugins\woocommerce\includes\class-wc-cart.php on line 1310
    wp-content\plugins\woocommerce-services\classes\class-wc-connect-taxjar-integration.php on line 361,571

    The root issue is to remove the "woofs_keys" from the cart items as its things its a line item when it send it to paypal for checkout.


  •  1,223
    Dustin replied

    Hi christopher,

    Please send me your website info (wp-admin link, username, password) then I can check this problem for you. You also can create a dev/staging site with the same issue then I'll work on it. You can read more about sending secure login information here https://wpclever.net/faqs/sending-secure-login-information.

    Best regards,
    Dustin