Restrict Purchase Order to Category

RedERedE Member
I use to use a snippet for disallowing the Purchase order option based on coupon code. The form post for that is here:
https://forum.foxycart.com/discussion/6598/restrict-purchase-order-to-category

That snippet doesn't seem to work with version 2. Can someone tell me what I need to change?
Comments
  • fc_adamfc_adam FoxyCart Team
    @RedE,

    Sorry we missed your previous post! Thanks for posting again. For 2.0 it will need an updated approach, and we'd recommend handling it within the templates directly for 2.0 rather than with javascript as we previously suggested.

    It looks like you've already got the option there for only showing purchase orders if one of a specific set of categories is present in the cart. You can expand on that logic to also check for the presence of a coupon, and stop purchase orders from being available if it's present. The updated logic - using your current set up as a base - would look like this: https://pastebin.com/raw/fmDM00y4

    The code on that link can replace the code of the same on your "checkout" template in the administration. It's the code that's included between the {% embed 'checkout.inc.twig' %} and {% endembed %} tags. You'll also need to update the COUPON_CODE text to match what the code is of the coupon you're looking for.
Sign In or Register to comment.