• Resolved Darryl.R

    (@darrylr)


    Hi, thanks for a great plugin.

    We’ve had a conflict with Woocommerce where the plugin interferes with the Coupon system. It allows the adding of the coupon to the cart, but prevents checkout (Error is that the coupon has been used already on another order)

    This is the summary of what we found:

    with context of this method: hide_not_approved_users_in_frontend
    ? every call to WP_User_Query using a specific key: meta_query is being overwritten by the filter in user-registration plugin
    ? if the meta_query already exists in the incoming query, the user-registration plugin should respect the original data keys.
    ? because the user-registration uses an “OR” clause, it should be appended like this:

    The existing code:

    $meta_query = array(
    'relation' => 'OR',
    array(
    'key' => 'ur_user_status',
    'compare' => 'NOT EXISTS',
    'value' => '',
    ),
    array(
    'key' => 'ur_user_status',
    'value' => UR_Admin_User_Manager::APPROVED,
    ),
    );

    Our temporary patch (really rough untested proposed code (We’re using the ur_user_hide_not_approved_users_in_frontend filter to do this, so my code is slightly different))

    $meta_query_default = array(
    'relation' => 'OR',
    array(
    'key' => 'ur_user_status',
    'compare' => 'NOT EXISTS',
    'value' => '',
    ),
    array(
    'key' => 'ur_user_status',
    'value' => UR_Admin_User_Manager::APPROVED,
    ),
    );
    if( isset($query->query_vars['meta_query']) ){
    $merged_meta = $query->query_vars['meta_query'];
    // this is so that the 'OR' clause doesn't cause issues
    $merged_meta[] = $meta_query_default;
    }
    else{
    $merged_meta = $meta_query_default;
    }
    
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Amrit Kumar Shrestha

    (@shresthauzwal)

    Hi @darrylr,

    Thank you for the suggestion,

    We are not clear whether the patch code you mentioned worked for your third-party coupon plugin conflict. Also, are you suggesting these codes need to include in our plugin updates?

    Regards!

    Thread Starter Darryl.R

    (@darrylr)

    Hi Amrit

    The conflict is with Woocommerce’s Coupon component. Woocommerce is a very popular e-commerce plugin for WordPress.

    The code attached patched the issue for us, it’s provided as is; feel free to evaluate it and use it – or create your own patch to fix the issue. (Obviously we would prefer that your plugin is updated with a similar fix)

    I hope that helps?

    • This reply was modified 2 years, 4 months ago by Darryl.R. Reason: clarity
    Plugin Support Amrit Kumar Shrestha

    (@shresthauzwal)

    Hi @darrylr,

    Thank you for the clarification,

    As we know, the coupon plugin you mentioned is not the official product of Woocommerce. It is hosted on woocommerce.com as an addon of WooCommerce, like we have hosted a few products for Woocommerce. Here is the link to the product https://woocommerce.com/products/customize-my-account-for-woocommerce.

    We appreciate your suggestion; we will need to look into it before including it in our plugin because we already have the Woocommerce integration premium addon for user registration.

    Regards!

    Thread Starter Darryl.R

    (@darrylr)

    Hi Amrit

    Nope we dont use that plugin – the coupon system is default Woocommerce functionality see below link for your reference:

    https://woocommerce.com/document/coupon-management/

    Thank you

    Plugin Support Amrit Kumar Shrestha

    (@shresthauzwal)

    Hi @darrylr,

    Thank you for the link to the product, we will look into it ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Interferes with Woocommerce Coupon system’ is closed to new replies.