Support » Plugin: Stripe Payment Plugin for WooCommerce » Custom metadata

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi Raymond( @rfortin ): Please try with the latest version(3.0.4) of the plugin. We have added hook for altering charge params.

    Thread Starter rfortin


    I added the following code to my functions.php. I’m trying to add a test postal billing code to the metadata array.

    /*** Woocommerce Stripe Alter Charge Parameters ***/
    function my_stripe_meta_parameters($charge) {
        $extra_params = array(
    		'test_postal_code' => (WC()->version < '2.7.0') ? $wc_order->billing_postcode : $wc_order->get_billing_postcode()
    	// combine the two arrays
    	$charge['metadata'] = array_merge($extra_params, $charge['metadata']);
        return $charge;

    However, this causes an internal error. When I write instead
    'test_postal_code' => '999999'
    the code works and I see the order’s test postal code on my Stripe dashboard. For some reason
    (WC()->version < '2.7.0') ? $wc_order->billing_postcode : $wc_order->get_billing_postcode() is giving me a hard time. Any ideas?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom metadata’ is closed to new replies.