WordPress.org

Forums

WooCommerce - excelling eCommerce
Custom Payment Restrictions (4 posts)

  1. Maribor
    Member
    Posted 11 months ago #

    Hello everybody

    I'm working with latest WooCommerce and i'm looking for a way to restrict some of payment methods while still displaying them in Checkout page (I want to "grey out" them).

    What i have in mind is ...

    When customer is adding item to a cart and then procceds to checkout i want him to be able to view all possible payment methods but based on his status i want some of them to be "grey out" with additional information why is this grey out.

    I would want to grey out Cash on Delivery for new customers because of big return rate. I want them to still see that i allow this kind of a payment but only for returning customers and/or registered ones (shop allows buying without account)

    How can I achieve that? It will certanly require messing up with functions.php. Important part is that i want customer to see all method payments but grey out few of them until they will make their first purchase thru paypal or other gateway or register.

    Thank You for Your help.

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

  2. belindablakley
    Member
    Posted 11 months ago #

    I have a very similar issue, so I don't know if I should start a new thread or not...
    I would like to restrict certain payment options per specified users. All of my customers are registered (we don't allow guest checkout), but some of them are on payment terms, so we want to allow the "cheque" payment for some customers. I don't need it greyed out or anything, just visible or not depending on if it's allowed for that customer.

  3. Maribor
    Member
    Posted 11 months ago #

    Nobody?

    Okay, because my php knowledge is pretty much non-existant i've come up with few solutions and maybe someone will manage to put me on right track here with code.

    I've browsed thru all php files located in woocommerce folder and played around with COD option for test. I've manage to accomplish only one thing, now when user check "Cash on Delivery" his order is autotmaticly cancelled in system and he also recives email with that information.

    I've changed (In COD class)

    $order->update_status('on-hold', __( 'Your order wont be shipped until the funds have cleared in our account.', 'woocommerce' ));

    to

    $order->update_status('cancelled', __( 'Your order wont be shipped until the funds have cleared in our account.', 'woocommerce' ));

    But i still get redirect to ThankYouPage and order is still recived. For the worst part - beside displaying information about this delivery method being availabe only for returning customers i still need to proccess orders and New Customer can still choose "Cash on Deliver" as reliable option for his purchase. Information about canecelation is getting to him only after.

    I'm still looking for any possible way to "blank out/grey out" this option in checkout page (without hidding it). Should I look in function process_payment? Deleting all that function get's big error in woocommerce and everything is stopping to work.

    I'm pretty much confused right know and this seems like not so much of a complicated problem but with my knowledge of php it takes a big amount of time and i'm struggling with non-obiedient customers :)

    Please, some input?

  4. belindablakley
    Member
    Posted 11 months ago #

    So, it's probably not exactly what you're looking for, but you can get this woocommerce extension http://www.woothemes.com/products/role-based-payment-shipping-methods/ and define payment methods by role. You could use it in conjunction with this free plugin https://wordpress.org/plugins/groups/ to make a group for customers who have previously made a purchase and customers who have just registered.

    You might be able to then use css to create your greyed-out options.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.