Category: All

  • How to add a “Buy Now” button along with the “Add To Cart” button in Drupal Commerce ?

    How to add a “Buy Now” button along with the “Add To Cart” button in Drupal Commerce ?

    If you want to add a “Buy Now” button and an “Add To Cart” button to the Drupal eCommerce site, follow the code below. function custom_module_form_alter(&$form, &$form_state, $form_id) { if (strpos($form_id, ‘commerce_cart_add_to_cart_form’) !== false) { if (isset($form[‘product_id’][‘#value’])) { $product_id = $form[‘product_id’][‘#value’]; } else { $product_id = $form[‘product_id’][‘#default_value’]; } $form[‘buy_now_pid’] = array( ‘#type’ => ‘hidden’, ‘#name’ […]