Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter careyrob

    (@careyrob)

    Hi @mikedmoore ,

    I missed your response. Editing the order item and “recalculating” the order total may work for updating the product cost, but I’m using the WooCommerce Sales Tax Plugin.

    Since I have the “enable automated tax” setting selected if I remove the sales tax charge from the order items and click recalculate the Sales Tax is automatically re-applied. The only way to remove the sales tax from an order when using the WooCommerce Sales Tax Plugin is to edit the sales tax field on the order items and then click “Save” without clicking “recalculate”.

    I’m experiencing the same behavior. It started after updating to WordPress 5.5, but before updating from Woocommerce 4.3.1 to 4.3.2. The issue was not resolved by updating to woocommerce 4.3.2.

    Please advise.

    • This reply was modified 4 years, 6 months ago by careyrob.
    Thread Starter careyrob

    (@careyrob)

    I’m getting an error when I use this. I don’t see the function save_meta_data() defined in Woo-MP or WordPress.

    Should that be $order->save(); instead?

    Thread Starter careyrob

    (@careyrob)

    How about this snippet? Is this the right condition for adding this meta_data to the order?

    add_action( 'woo_mp_payment_complete', function ( $order ) {
    	$order->update_meta_data( '_stripe_charge_captured', 'yes' );
    	$order->save();
    }, 10, 1 );
    Thread Starter careyrob

    (@careyrob)

    I see that woo-mp records transaction data as a json string.

    Is the requirement any more complicated than posting a meta_data entry for _stripe_charge_captured at the same time as the woo-mp transaction meta_data or is additional validation required?

    Thread Starter careyrob

    (@careyrob)

    What is the field called that needs to be set?

    Thread Starter careyrob

    (@careyrob)

    In \\woo-mp.2.1.0\woo-mp\includes\payment-processor.php I find the following code:

    
          if ( $should_save_wc_payment ) {
                $method_title = $this->payment_gateway->get_custom_title();
    
                $charge['order']->set_payment_method( $method_title );
                $charge['order']->set_payment_method_title( $method_title );
                $charge['order']->set_transaction_id( $charge['trans_id'] );
                $charge['order']->set_date_paid( time() );
            }
    

    It looks like both ‘_payment_method’ and ‘_payment_method_title’ are being filled from the same source which is what’s causing my problem. I think the official stripe plugin just sets payment_method = ‘stripe’ and doesn’t enable the user to configure it as anything else through the settings page. The Stripe plugin does require the user to provide their desired ‘_payment_method_title’ through an input on the settings page that this value flows through for display to users.

    I’m not trying to maliciously ridicule your code here, just an observations:

    If the user selects the payment processor (Stripe) on the general settings page then couldn’t you use that input to properly set payment_method =’stripe’?
    Then you could decouple _payment_method and _payment_method_title so that the user could choose whatever title they wanted without breaking the order payment method assignment and payment method title display.

    What do you think?

    Thread Starter careyrob

    (@careyrob)

    Thanks @bfl.

    I changed the title to ‘stripe’ and the order payment method option updates properly to ‘Credit Card’ now, but my invoice now lists the payment method as ‘stripe’ instead of “Credit Card”. This simplifies my store administration workflows like I was hoping to do, but I expect that many customers will not understand that stripe is the credit card processor.

    Is there a code snippet I could add that will allow woo-mp to update the order payment method option to ‘Credit Card’ as it is now and also display the payment method on the invoice as ‘Credit Card’ as it does for stripe transactions processed through normal store checkout?

    If I look at the post_meta for a regular stripe payment I see the following data:
    _payment_method : stripe
    _payment_method_title : Credit Card

    And for the woo-mp stripe payment:
    _payment_method : stripe
    _payment_method_title : stripe

    I’ve sent my WooCommerce status report via email as you requested.

    Thread Starter careyrob

    (@careyrob)

    Thank you @bfl!

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