Foxy Forum Status

We're no longer responding to questions via our forum, but we will keep it up for historical reasons. If you can't find the answer you're looking for, please visit our knowledge base or contact us. If there's enough interest in the future, we may bring the forum back.

Changing checkout type depending on product type

AdeelAdeel Member
Hi there,

My client have two just products , one is subscription and other is physical product.

Is it possible to checkout as guest if product in the cart is physical product (non subscription prod) and Create account only if the product in the cart is subscription?

  • fc_adamfc_adam FoxyCart Team

    Good question. You could add a small bit of Twig logic to the top of your checkout template to conditionally change the checkout type for the customer like this:
    {% if has_subscriptions %}
    {% set checkout_type = "account_only" %}
    {% else %}
    {% set checkout_type = "guest_only" %}
    {% endif %}
    That should then dynamically change the setting based on whether subscriptions are present or not. For what it's worth - when subscriptions are present in the cart, the checkout will default to being account only as well, but if you wanted to force it to be guest only for non-subscription products, you'll need something like the above.
  • AdeelAdeel Member
    Awsome... Thanks Bro.
Sign In or Register to comment.