Check CC Number Errors (tag pair)
check_cc_number_errors validates a credit card number (and optional card type) and returns validation result variables.
This is a legacy validation helper tag pair.
See also:
Parameters
credit_card_number
Credit card number to validate.
credit_card_number="4111111111111111"
card_type
Optional expected card type/brand used in validation.
card_type="visa"
Variables
valid(true/falsestyle output)errors(empty string when valid, localized error message when invalid)
Behavior and Constraints
- Initializes output as
valid = true,errors = ''. - If
credit_card_numberis missing, sets missing-number error message. - Runs
validate_credit_card(credit_card_number, card_type). - If invalid, maps error codes to localized messages:
- unknown card type
- card type mismatch
- invalid card number
- incorrect card length
- fallback unknown-type message
- Returns parsed variables row.
Examples
Basic validation output:
{exp:cartthrob:check_cc_number_errors credit_card_number="4111111111111111" card_type="visa"}
Valid: {valid}<br>
Error: {errors}
{/exp:cartthrob:check_cc_number_errors}
Display only when invalid:
{exp:cartthrob:check_cc_number_errors credit_card_number="{credit_card_number}" card_type="{card_type}"}
{if errors}
<p class="error">{errors}</p>
{/if}
{/exp:cartthrob:check_cc_number_errors}