Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter erikfrick

    (@erikfrick)

    Huh. I had no idea, but ended up picking the same meta field name as you.

    Nevermind then! And thank you 🙂

    Thread Starter erikfrick

    (@erikfrick)

    If I put the below in my theme’s functions.php file, would that work?

    // INSTAGRAM IMPORTER TWEAK; store **insta-link** as a custom field
    
    add_action( 'dsgnwrks_instagram_post_save', 'dsgnwrks_instagram_save_postmeta_fields', 4 );
    
    function dsgnwrks_instagram_save_postmeta_fields( $post_id, $instagram_photo_object, $post_args, $user_settings ) {
    
    	$instagram_link = substr( $instagram_photo_object->link, 0 );
    	update_post_meta( $post_id, 'instagram-link', $instagram_link );
    }
    Forum: Plugins
    In reply to: [WP Stripe] Commas?

    Ok, my initial theory was only slightly wrong. I thought it was a JS validation issue, when it was really an issue with PHP validation. Yeesh! Follow instructions below to fix the issue.

    In your wp-stripe plugin folder open the stripe-functions.php file in the ‘includes’ folder. Go down to lines 118-121 or so, you’ll see something like this:

    $public = $_POST['wp_stripe_public'];
    $name = $_POST['wp_stripe_name'];
    $email = $_POST['wp_stripe_email'];
    $amount = str_replace('$', '', $_POST['wp_stripe_amount']) * 100;
    $card = $_POST['stripeToken'];

    Change that block to:

    $public = $_POST['wp_stripe_public'];
    $name = $_POST['wp_stripe_name'];
    $email = $_POST['wp_stripe_email'];
    $amount = str_replace(',', '', $_POST['wp_stripe_amount']);
    $amount = str_replace('$', '', $amount) * 100;
    $card = $_POST['stripeToken'];

    Basically, all we’re doing is stripping out commas from the string before we strip out the dollar signs and convert the dollar amount to cents (that’s how Stripe likes it’s amounts).

    Forum: Plugins
    In reply to: [WP Stripe] Commas?

    I’m having this same issue. My guess is that it has to do with the validation of the information. I still need to test this, but my theory is that the wp-stripe.js file, line 60 is breaking when it encounters a comma in the field. That line is converting the amount to charge into cents.

    A quick test in the JS console shows that:
    1,000 * 100 = 0

    but that:
    1000 * 100 = 100000

    Again, I still need to test this out, but I sure hope it’s as simple as that.

Viewing 4 replies - 1 through 4 (of 4 total)