Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter sopaitun

    (@sopaitun)

    @mrclayton

    I tried add this in theme’s function file:

    function pbn_add_order_meta_data($meta_data, $order) {
        foreach ( $order->get_items ( 'line_item' ) as $item ) {
            /**
             *
             * @var WC_Order_Item_Product $item
             */
            $product = $item->get_product ();
            $meta_data[ 'product_' . $product->get_id () ] = sprintf ( '%s x %s', $product->get_id (), $item->get_quantity () );
        }
        return $meta_data;
    }
    
    add_filter ( 'wc_stripe_order_meta_data', 'pbn_add_order_meta_data', 10, 2 );

    It worked at 1st time. However when I update or re-active plugin, it just add more line in metadata instead of changing metadata.
    All I want is not showing product name in metadata. Please help

    Thread Starter sopaitun

    (@sopaitun)

    Hi @mrclayton

    I tried to add these codes below to function file of pl;ugin:

    function add_order_meta_data($meta_data, $order) {
        $meta_data[ 'product_' . $product->get_id () ] = sprintf ( '%s x %s', $product->get_order_identifier (), $item->get_quantity () );
        return $meta_data;
    }
    
    add_filter ( 'wc_stripe_order_meta_data', 'add_order_meta_data', 10, 2 );

    However these codes made plugin not work anymore.
    Please help

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