Support » Plugin: WooCommerce Pay for Payment » Enable only for specific product ids,tags or brands

  • Resolved sikhalsa

    (@sikhalsa)


    Hi nice plugin, is it possible if I can enable extra charge only on specific products? using product id, tag or brand.any help will be appreciated

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Karolina Vyskocilova

    (@vyskoczilova)

    Hi, thanks 🙂

    ah, yes, you can use filters (see Github), some examples could be found in the forum for example here: https://wordpress.org/support/topic/zero-charge-for-certain-items/

    If you need a custom work, send me an email and we can talk about it. I’m thinking about making a PRO version including this kind of feature (with an user interface) do you think that you would buy it for getting easily this kind of features?

    Best regards and thanks,
    Karolina

    I don’t mind paying for pro version if price is reasonable

    Plugin Author Karolina Vyskocilova

    (@vyskoczilova)

    🙂 Thanks, could I let you know when the code is ready for test? I would offer you free license in exchange.

    If you need a help with the filters for now on, let me know

    Best regards,
    Karolina

    Hi Karolina

    Thanks for your help the link you shared last time helped me a lot and I came up with the code below that is working like charm. I would love to get the licensed plugin from you.

    Paste this code in your functions.php file and you good to go.

    function my_pay4pay_handle_tag( $do_apply , $current_payment_gateway ) {
    // set our flag to be false until we find a product in that tag
    $tag_check = false;

    // check each cart item for our tag
    foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {

    // I have razer tag in product replace it with your tag.
    $product = $cart_item[‘data’];
    if ( has_term( ‘razer’, ‘product_tag’, $product->id ) ) {
    $cat_check = true;
    // break because we only need one “true” to matter here
    break;
    }
    }

    // if a product in the cart is in our tag, enable the plugin
    if ( $cat_check ) {
    return $do_apply;
    }else {
    return false;
    }
    }
    add_filter( “woocommerce_pay4pay_apply”, “my_pay4pay_handle_tag” , 10 , 4 );

    I need your help with something else now, I want to change payment gateway description when your plugin is enabled. For instance, if the plugin is not available description should be: “Pay with bank transfer.” and if the plugin is enabled then description should be: “Pay with the bank transfer, Please note that 2% + $0.40 will be charged per transaction.”

    I hope you understand what I am looking for.

    Plugin Author Karolina Vyskocilova

    (@vyskoczilova)

    Hi, sikhalsa,

    thanks a lot, glad you solved your trouble. I will note you as a potential beta tester and get back to you later in this year (I will post it here, or send me an email to karolina@kybernaut.cz and I will save you to the beta testers contact list).

    I understand the last question, but you will probably need to modify the part of your theme or create a WC template at the place where the description is displayed. Either add a custom field for the second case or hardcode the text. My plugin doesn’t have an option to touch this even if it would be great to have it.

    Thanks for understanding
    Karolina

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Enable only for specific product ids,tags or brands’ is closed to new replies.