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

  • What module are you using to provide that button? – David Thomas Jun 22 '13 at 23:54
  • just using commerce_paypal .. – Patoshi パトシ Jun 23 '13 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 – Nigel Waters Jun 23 '13 at 2:02
  • @NigelWaters That could be an answer, although I am not sure this question is not too localized. – kiamlaluno Jun 23 '13 at 9:37
  • Yea it seems to be commerce_paypal_ec -- express checkout... – Patoshi パトシ Jun 23 '13 at 16:24
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.

  • 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? – Sam152 Sep 30 '13 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. – Ryan Szrama Oct 3 '13 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',
   ),
 ),
);
  • 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 '17 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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