• Resolved Ahmed_Ali

    (@ahmed_ali)


    Hi dear,

    As i am displaying a product on my checkout cart page and i want to hide the checkout button after user added this product in the cart. I used

    if( edd_is_checkout() ) {

    $button_display = ‘style=”display:none;”‘;
    $checkout_display = ‘style=”display:none;”‘;

    }else{

    $button_display = ‘style=”display:none;”‘;
    $checkout_display = ”;

    }

    in easy-digital-downloads/includes/template-functions.php

    and it works very nicely but i was wondering as this is not a good idea to update the plugin files and next update of EDD may remove my customization….

    So is there any way i can add this function to my child theme functions.php or anything else?

    https://www.ads-software.com/plugins/easy-digital-downloads/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi Ahmed,

    I’m sorry for the delay here. You definitely do not want to ever edit core plugin files. So it’s best to reverse what you’ve edited.

    The simplest way to do this is with CSS. When you set a page as your checkout page in the EDD settings, a class is added to the body element on that page: edd-checkout. You could just have CSS that uses that class and the edd_go_to_checkout on the checkout button. So…

    .edd-checkout . edd_go_to_checkout { display: none; }

    Thread Starter Ahmed_Ali

    (@ahmed_ali)

    Woww you are the guy… thanks sdavis.

    i just have one more question as i was using a text line of few words in variable price dive “<div class=”edd_price_options edd_<?php echo esc_attr( $mode ); ?>_mode”>” so when a user add the item in cart this line will automatically hide with variable prices….

    Right now i am using the same condition.

    <?php if( edd_is_checkout() ) { ?>

    Would you like to add “Product name”

    <?php } ?>

    on (easy-digital-downloads/includes/template-functions.php) it works nicely but i don’t really feel good by editing the plugin files…

    is there any other way to hide that line when user add this item in the cart???

    Well thanks again you guys are really doing a serious awesome job….

    Can you explain in more detail? I’m not quite sure I understand what you are trying to do.

    Thread Starter Ahmed_Ali

    (@ahmed_ali)

    and the checkout hidden class works on my one site but on another site i am using a customized template for checkout page this class is not working on my other site is there any other class for customized checkout template??

    Thread Starter Ahmed_Ali

    (@ahmed_ali)

    Actually i am trying to write a note line before variable prices for example i am trying to write would you like to support us before variable prices and when user select one price and add it to cart i want the line “would you like to support us” disappear with variable prices…

    Thread Starter Ahmed_Ali

    (@ahmed_ali)

    is there any solution???

    Sorry for the long delay here.

    Unfortunately, if I am understanding what you’re describing correctly, this is outside of the scope of support. It sounds like you need custom development. If you have introduced customized templates you will want to create the logic that adds classes for you based on template usage. Likewise, anything that appears or disappears based on an action (like choosing a variable pricing selection) will require custom JavaScript.

    Perhaps you can contact someone on our recommended consultants list: https://easydigitaldownloads.com/consultants/

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Hide Checkout Button after "Add to Cart"’ is closed to new replies.