0

I am looking for a way to check if certain products of a specific category are in cart and then based on that hide a specific payment method.

I have found this thread which deals with basically the same problem but checks if a certain product is in cart.

I'd like to tackle this with a broader approach, thus aiming for categories since products can be added all the time.

1 Answer 1

0

I solved this by using Stash. I now check for certain channels that contain products where payment with PayPal isn't allowed.

It goes like this:

{exp:stash:set name="is_channel" parse_tags="yes" parse_conditionals="yes" default="0"}
    {exp:cartthrob:cart_items_info}
        {if channel_name == "channel_a"}1{/if}
        {if channel_name == "channel_b"}1{/if}
        {if channel_name == "channel_c"}1{/if}
    {/exp:cartthrob:cart_items_info}
{/exp:stash:set}

then in the template code:

{exp:stash:parse process="end"}
    {if {exp:stash:is_empty name="is_channel"}}
        Content here
    {/if}
{/exp:stash:parse}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.