2

I am working on a free/paid listing site. I setup Commerce Node Checkout with Node Checkout Expire and have a free version(14 days) and a paid "featured" option (30 days). The paid option should go to cart->checkout->payment while the free option should act and behave as if Drupal Commerce wasn't installed.

I was looking around rules but I can't seem to find the proper events/conditions/actions to basically treat free listings as regular drupal nodes. I don't really want to track orders for free listings, but I also don't want to mess Drupal Commerce's reporting up either.

Can rules do this? And if so, what would be the proper events/conditions/actions to bypass Commerce all together and just publish the node if "free listing" is selected under listing options for Node Checkout.

Thanks

1
  • Hi,have you found a solution to this?I am interested in bypassing checkout based on a role.thanks
    – Dion
    Commented May 17, 2015 at 20:50

2 Answers 2

1

You can write a custom module that implements hook_node_submit() and that sets

$form_state['values']['commerce_node_checkout_skip'] = True;

if the free version is selected.

3
  • You could also use rules to do this if you preferred.
    – rooby
    Commented Apr 15, 2015 at 0:31
  • @rooby:Could you please tell me how can I do this with rules?thank you
    – Dion
    Commented May 21, 2015 at 17:41
  • Also I tried this code but it didn't work: function custom_node_submit() { global $user; if (in_array('administrator', $user->roles)) { $form_state['values']['commerce_node_checkout_skip'] = True; } }
    – Dion
    Commented May 21, 2015 at 18:12
0

Here is the code that worked for me:

function custom_node_submit($node, $form, &$form_state) {

global $user;

if (in_array('administrator', $user->roles)) { $form_state['values']['commerce_node_checkout_skip'] = True; $node->status = 1; }

return $form;

}

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.