• silverfox3019

    (@silverfox3019)


    My site has both trade customers and wholesale customers. When a customer is logged on as a wholesale customer I need to remove all ClearPay messaging on Product pages. I have tries hooking into ‘clearpay_is_product_supported’ but all this does is return a message ‘ClearPay  is not available for purchasing this item’ I would like to remove the ClearPay message altogether.

    // Hook into the 'clearpay_is_product_supported' filter
    add_filter( 'clearpay_is_product_supported', 'disable_clearpay_for_wholesale_users', 10, 2 );

    function disable_clearpay_for_wholesale_users( $is_supported, $product ) {
    // Get the current user
    $current_user = wp_get_current_user();

    // Check if the current user has the 'wholesale' role
    if ( in_array( 'wholesale', (array) $current_user->roles ) ) {
    // Set to false to disable Clearpay for wholesale users
    $is_supported = false;
    }

    return $is_supported;
    }

Viewing 3 replies - 1 through 3 (of 3 total)
  • Chester from Afterpay

    (@chesterz4afterpay)

    Hi @silverfox3019,

    Thanks for your message.

    Hiding the messaging based on user roles is currently not supported. A feature request has been created in the backlog and will be reviewed by the team.

    Thank you.

    Thread Starter silverfox3019

    (@silverfox3019)

    Hi Chester many thanks for your reply.

    Is there not a hook that can be disabled with a code snippet?

    Chester from Afterpay

    (@chesterz4afterpay)

    Hi @silverfox3019,

    Thanks for following up.

    The plugin supports hiding the messaging altogether, but not based on custom conditions. This feature request has been raised with the team for their review and evaluation, and this forum topic is linked to the request. An update will be provided here if and when the feature is included in a release.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.