• Resolved officeasst

    (@officeasst)


    Hi, on this website and another website I’m trying to figure out how to add an extra fee based on user role. We charge an extra shipping fee for residential addresses, and I was thinking if I could make a role for it, there should be some way to automatically add a standalone fee at checkout. Not sure how to do that, though. Any suggestions? (I listed one site, but this would apply to 2 sites.) Thanks.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Hannah S.L.

    (@fernashes)

    Automattic Happiness Engineer

    > We charge an extra shipping fee for residential addresses

    Is there any way to tell from the address, for example by zip code, if it’s residential? In that case, you could handle this using shipping zones.

    You can add a fee based on the user role, but you’d need to manually set the role before the customer would see the fee. Here’s a snippet of code to add the fee:
    https://www.remicorson.com/add-custom-fee-to-woocommerce-cart-dynamically/

    Thread Starter officeasst

    (@officeasst)

    Hi, Hannah, thanks for that. I am also using the plugin User Role Editor, so would that count as manual?

    Also, how would I tweak the specifics of this code (assigning it to the role, setting the fee amount, and changing the fee name that shows on the frontend)? I usually know enough to find my way around in code, but I don’t know how to write code myself.

    Thanks!

    Dustin Hartzler

    (@dustinhartzler)

    Automattic Happiness Engineer

    You would use the code in Remi’s post and change the text Custom to the name of your user group.

    The 5 in the text equates to $5 (or whatever currency) and will display at checkout.

    Thread Starter officeasst

    (@officeasst)

    OK, thanks Dustin. And applying to the user role? How would that connect? Seems like you’d have to add another line of code or something to specify it.

    Thread Starter officeasst

    (@officeasst)

    Oh wow, I am so stupid. Sorry guys, I just looked at this again and realized you answered my question already. Works beautifully so far! Thanks for the tip!

    Plugin Support Hannah S.L.

    (@fernashes)

    Automattic Happiness Engineer

    Thanks for letting us know – I’m glad to hear it!

    Thread Starter officeasst

    (@officeasst)

    I actually may need more help with this after all, guys. I just had another customer (who is not in my Residential Fee group) place an order, and a residential fee got added. I`ll process it, since the payment has been processed, but I may have missed something. Is there a way to ensure that my fee only applies to the user group “Residential Fee”? I don’t want to charge other people extra, just that one group.

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Adding extra fee by user role?’ is closed to new replies.