How to redirect the user to a product page (node) after payment is made?
I'm using the Commerce Express Checkout module. That's why in the Shopping cart can be just one product.
How to redirect the user to a product page (node) after payment is made?
I'm using the Commerce Express Checkout module. That's why in the Shopping cart can be just one product.
One option is to use hook_menu_alter in a custom module to override your current destination page with a redirect.
<?php
function mymodule_menu_alter(&$items) {
$items['current/checkout/path'] = array(
'page callback' => 'drupal_goto',
'page arguments' => array('new/checkout/path'),
'access callback' => TRUE,
);
}
To use the above code, you'll have to create a module.
1) Create a directory to be used for this module, e.g. /sites/all/modules/MYMODULE
2) Create MYMODULE.info, e.g. /sites/all/modules/MYMODULE/MYMODULE.info
. Paste the following into the file.
name = MYMODULE
description = "Module description."
package = Custom
core = 7.x
3) Create MYMODULE.module, e.g. /sites/all/modules/MYMODULE/MYMODULE.module
. Paste the following into the file.
<?php
function MYMODULE_menu_alter(&$items) {
$items['current/checkout/path'] = array(
'page callback' => 'drupal_goto',
'page arguments' => array('node/123'),
'access callback' => TRUE,
);
}
4) Replace all instances of MYMODULE
with your desired module name. Replace current/checkout/path
with the current path of the checkout. Replace node/123
with the new checkout path. Lastly, enable your new module.
This will tell Drupal to replace the current checkout page with a redirection to the new one.
'page arguments' => array('node/NID'),
.
Dec 3, 2014 at 0:55
Another option is to add a rule, based on the event 'checkout complete' / 'first paid in full'.