1

After adding an item to the cart in drupal 7 commerce, the /cart page has a checkout with paypal button. Is there a way to remove this in the commerce payment configuration pages? It seems unnecessary and confusing. I know I can hide it via css, but was wondering if there was a option somewhere.

enter image description here

5
  • What module are you using to provide that button? Jun 22, 2013 at 23:54
  • just using commerce_paypal .. Jun 23, 2013 at 0:05
  • 2
    That's not provided by the commerce PayPal module. I have many sites running it and have never seen that before. It must be provided by something else. Maybe drupal.org/project/commerce_paypal_ec Jun 23, 2013 at 2:02
  • @NigelWaters That could be an answer, although I am not sure this question is not too localized.
    – apaderno
    Jun 23, 2013 at 9:37
  • Yea it seems to be commerce_paypal_ec -- express checkout... Jun 23, 2013 at 16:24

3 Answers 3

3

This button comes from the Express Checkout module in the Commerce PayPal project. If you don't need Express Checkout, just uninstall that module. If you do, it's a functional requirement of PayPal for the button to be present here. However, I will go open a feature request now to turn that into an area handler for Order Views. Makes sense and would do what you're asking.

2
  • Wait, so paypal requires the button to be present on that step or it's one of the modules non-configurable features? Which paypal module provides the same functionality later in the checkout process?
    – Sam Becker
    Sep 30, 2013 at 10:10
  • The same module handles both the "shortcut" flow (which is the button at /cart) and the "mark" flow (which is the payment option on the checkout form). If you don't want it on /cart for now, you can use hook_form_alter() to remove it or potentially hook_module_implements_alter() to prevent it from being added in the first place. Oct 3, 2013 at 23:32
5

If found a simple way to disable the button through rules.

Edit the configuration of the Paypal EC payment method and add a condition to the rule:

Data Comparison / Commerce Order...state / Equal to 'Checkout'

In this way, when the order is still in Shopping Cart state the payment method is disabled.

1

Although it's not recommended, you can comment these lines:

$form['paypal_ec'] = array(
 '#type' => 'image_button',
 '#value' => t('Check out with PayPal'),
 '#src' => commerce_paypal_ec_button_url(),
 '#attached' => array(
   'css' => array(
     drupal_get_path('module', 'commerce_paypal_ec') . '/theme/commerce_paypal_ec.theme.css',
   ),
 ),
);
1
  • Altering the paypal_ec paypal form maybe a an option. But please, not inside the module itself. Better to go for a much safer hook_form alter
    – Augusto
    Dec 9, 2017 at 9:20

Your Answer

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

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