Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • I am having the same problem. Can someone please guide us what has happened? Its really frustrating!!! Please look into this issue.

    The answer of the above mentioned question is “Yes”. We can hide the shipping methods only in Apple Pay Using Stripe. Currently, there is no settings both in Woo-commerce and Stripe to select the specific shipping methods. But you can achieve that functionality by adding custom code in the right file and function. Please follow all the steps:

    Step1: The file url for Stripe is listed below: woocommerce-gateway-stripe/includes/payment-methods/class-wc-stripe-payment-request.php

    Step2: Look for the following function in the file public function get_shipping_options( $shipping_address, $itemized_display_items = false )

    Step3: Remember that “STRIPE” by default uses the first Shipping method by default. So you need to check in that particular function, where that thing is happening.

    Step4: Right before that specific IF condition — “if ( isset( $data[‘shipping_options’][0] ) )”

    Step5: Insert the Following Code before that IF condition

    foreach($data['shipping_options'] as $index => $myshipping){
                if(strpos($myshipping['label'],'Select Future Date') !== false){
                    unset($data['shipping_options'][$index]);
                    $data['shipping_options']= array_values($data['shipping_options']);
                }
            }

    Note: You can do by ID or any other element in an Array. You just need to match the shipping method ID and then Unset that ID. Please don’t forget to update the array by using array_values() function.

    • This reply was modified 3 years, 5 months ago by talha93tariq.
Viewing 2 replies - 1 through 2 (of 2 total)