• Resolved Nazar

    (@zaaz28)


    Hello,
    I found a bug when using WC()->cart->add_to_cart() function. I’m getting an error


    Uncaught TypeError: YAYDP\Admin_Order\Order_Discount_Manager\YAYDP_Order_Discount_Cart_Discount_Manager::remove_yaydp_discounts(): Argument #1 ($order) must be of type WC_Order, string given, called in /wp-includes/class-wp-hook.php on line 324 and defined in /wp-content/plugins/yaypricing/includes/admin-order/order-discount-manager/class-yaydp-order-discount-cart-discount-manager.php:31

    And I found why it’s happening.

    You have an action with name yaydp_before_calculate_cart_discount with required param $order but do not send it in calculate_pricings function in file yaypricing\includes\core\managerclass-yaydp-cart-discount-manager.php. Attached function for action – https://prnt.sc/O2_ZcYS_TrQu

    So to solve – add a condition to check if $order exists and remove condition \WC_Order to check type. Or send $order in file where I found an error.

    Screenshots – https://prnt.sc/W9cG9Q-xzqM4 https://prnt.sc/Lx3DpPFdGAjM

    Looking forward,
    Nazar

    • This topic was modified 2 months, 2 weeks ago by Nazar.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.