-
-
Save 5ally/a7ede4ad1ab57fc8847b24682f374e9e to your computer and use it in GitHub Desktop.
See https://stackoverflow.com/a/56731467/9217760 for details.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // File: wp-content/themes/your-theme/woocommerce/myaccount/topup-form.php | |
// If the current user is **not** a "customer", show the topup form. | |
if ( ! current_user_can( 'customer' ) ) : ?> | |
<form method="post"> | |
<h3><label for="topup_amount"><?php _e( 'Top-up Account Funds', 'woocommerce-account-funds' ); ?></label></h3> | |
<p class="form-row form-row-first"> | |
<input type="number" class="input-text" name="topup_amount" id="topup_amount" step="0.01" value="<?php echo esc_attr( $min_topup ); ?>" min="<?php echo esc_attr( $min_topup ); ?>" max="<?php echo esc_attr( $max_topup ); ?>" /> | |
<?php if ( $min_topup || $max_topup ) : ?> | |
<span class="description"> | |
<?php | |
printf( | |
'%s%s%s', | |
$min_topup ? sprintf( __( 'Minimum: <strong>%s</strong>.', 'woocommerce-account-funds' ), wc_price( $min_topup ) ) : '', | |
$min_topup && $max_topup ? ' ' : '', | |
$max_topup ? sprintf( __( 'Maximum: <strong>%s</strong>.', 'woocommerce-account-funds' ), wc_price( $max_topup ) ) : '' | |
); | |
?> | |
</span> | |
<?php endif; ?> | |
</p> | |
<p class="form-row"> | |
<input type="hidden" name="wc_account_funds_topup" value="true" /> | |
<input type="submit" class="button" value="<?php _e( 'Top-up', 'woocommerce-account-funds' ); ?>" /> | |
</p> | |
<?php wp_nonce_field( 'account-funds-topup' ); ?> | |
</form> | |
<?php endif; // end "customer" role check ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment