WordPress.org

Forums

WooCommerce - excelling eCommerce
Coupon Usage Limits per User - error messages (6 posts)

  1. gregs.legs
    Member
    Posted 1 year ago #

    I have coupons where I have specified that a user can only use a coupon once and have noticed that whenever a customer places an order I get an error log entries:

    PHP Warning: array_keys() expects parameter 1 to be array, boolean given in /wp-content/plugins/woocommerce/includes/class-wc-cart.php on line 1499 ... and line 1502.

    and:

    PHP Warning: Illegal offset type in isset or empty in /wp-includes/meta.php on line 466.

    Line 1493 of class-wc-cart.php reads:

    $used_by = get_post_meta( $this->id, '_used_by' );

    I'm new to coding so forgive me if I've got this all wrong but this looks to me like its looking for the _used_by meta in the cart post rather than the coupon post.

    Any help with this would be greatly appreciated.

    Thanks
    Greg

    https://wordpress.org/plugins/woocommerce/

  2. gregs.legs
    Member
    Posted 1 year ago #

    Forgot to mention, I'm using:

    WordPress 3.9
    Woocommerce 2.1.7

  3. Joskhuu2
    Member
    Posted 1 year ago #

    Same here, only when the coupon is set to be used once.
    Did you found a sollution Greg ?

    Kind regards,
    Jos

  4. gregs.legs
    Member
    Posted 1 year ago #

    Not yet ...

  5. Joskhuu2
    Member
    Posted 1 year ago #

    Thx for the quick reply, I don't know if you get the header error to, but this is my complete error list :

    `Warning: array_keys() expects parameter 1 to be array, boolean given in /home/vhosts/.../httpdocs/wp-content/plugins/woocommerce/includes/class-wc-cart.php on line 1499

    Warning: array_keys() expects parameter 1 to be array, boolean given in /home/vhosts/.../httpdocs/wp-content/plugins/woocommerce/includes/class-wc-cart.php on line 1502

    Warning: array_keys() expects parameter 1 to be array, boolean given in /home/vhosts/.../httpdocs/wp-content/plugins/woocommerce/includes/class-wc-cart.php on line 1502

    Warning: Cannot modify header information - headers already sent by (output started at /home/vhosts/.../httpdocs/wp-content/plugins/woocommerce/includes/class-wc-cart.php:1499) in /home/vhosts/.../httpdocs/wp-includes/pluggable.php on line 1121

  6. Joskhuu2
    Member
    Posted 1 year ago #

    I don't know if this is the solution but if you add <?php ob_start(); ?> in the top of your functions.php, the coupon should work ( at least it seems to work for me )

    But i'm not an expert so i don't know if this is the best solution.

    Kind regards,
    Jos

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic