Your function's arguments are wrong.
See hook_form_alter docs.
So basically you need to rewrite your function as follows.
First, grab the correct form ID.form_alter functions don't have a $node but in some forms, full node object form is in $form.
So use the following code. You will now see at least 2 message on your messages area with form ID and array explanation of $form.
function uc_button_form_alter(&$form, &$form_state, $form_id) {
drupal_set_message($form_id);
drupal_set_message('<pre>'.print_r($form, 1).'</pre>');
};
Now, check if the node ID you are looking for is available in the $form array. (in most cases, it's in $form['#node']).
Now you can change the function to the real code.
function uc_button_form_alter(&$form, &$form_state, $form_id) {
if (isset($form['#node']->nid) && $form_id == 'edit-submit-' . $form['#node']->nid) {
$form['submit']['#attributes']['class'] = 'node-add-to-cart';
$form['submit']['#attributes']['xxx'] = 'xxx'; // we don't want to clear existing values.
}
};
However, even this implementation is not necessary. You can make use of default classes with tricky nesting if you only want to add a class to the button.
Update after 3rd comment:
Try this:
function uc_button_form_alter(&$form, &$form_state, $form_id) {
if (isset($form['nid']['#value']) && $form_id == 'edit-submit-' . $form['nid']['#value']) {
$form['submit']['#attributes']['class'] = 'node-add-to-cart';
$form['submit']['#attributes']['xxx'] = 'xxx'; // we don't want to clear existing values.
}
};