Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi
Is there a way to add the EC button on any page of the site rather than just the cart.
I've tried adding:
if (commerce_paypal_ec_enabled()) {
global $user;
$order_id = commerce_cart_order_id($user->uid);
$order = commerce_order_load($order_id);
// And Express Checkout is also available as a payment option in checkout...
if (commerce_paypal_ec_enabled($order)) {
// Add the Express Checkout form as a suffix to the cart form.
$payment_method = commerce_payment_method_instance_load('paypal_ec|commerce_payment_paypal_ec');
$ec_form = drupal_get_form('commerce_paypal_ec_order_form', $payment_method, $order);
$ecb .= drupal_render($ec_form);
// Add the Bill Me Later form with a separator if enabled.
if (!empty($payment_method['settings']['enable_bml'])) {
$bml_form = drupal_get_form('commerce_paypal_bml_order_form', $payment_method, $order, TRUE);
$ecb .= drupal_render($bml_form);
}
}
echo $ecb;
}
into a php block, which renders the button fine but when submitted just comes back to the same page with no redirect. I looked at commerce_paypal_ec_order_form_submit but cannot see why this will not work.
Any help would be really great, thanks .