0

i am getting an issue on paypal or google pay order review we have 2 shipping mehtods 1 is free and 2 is surcharge if customer enter specific post code the surcharge display on checkout its fine it not display free shipping when other method display but on paypal order review page its shows both please advice please is steps steps

  • Add Product to cart
  • Click on pay-pal Express checkout
  • PayPal popup open and after getting details redirect to review page Actual Result
  • On review page its display both methods. Expected Result
  • Should hide free method when other method is enabled and show free method if specific postal code not there in address

2 Answers 2

0

To hide the free shipping method when another shipping method is enabled and show the free method only if a specific postal code is not present in the address, you will need to modify the integration of your checkout process with PayPal and Google Pay. Here are the general steps you can follow:

1)Identify the code or plugin responsible for integrating PayPal and Google Pay with your website's checkout process. This could be a custom code or a third-party plugin/module.

2)Locate the section of code that handles the display of shipping methods on the review page. This code determines which shipping methods are shown to the customer.

3)Within that code, add a condition to check if the specific postal code is present in the customer's address. If the postal code is present, hide the free shipping method. If the postal code is not present, show the free shipping method.

4)Test the checkout process with different scenarios to ensure that the free shipping method is displayed correctly based on the presence or absence of the specific postal code.

Note: The exact implementation steps will depend on the specific platform, framework, or plugins you are using for your website. It's recommended to consult the documentation or support resources provided by the platform or plugin developers for more specific guidance tailored to your setup.

1
  • how we can disable free shipping can we use unsetShiippingMethod?
    – alam
    Jun 7, 2023 at 13:45
0

try it like this create a custom module and create plugin like below

etc/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Shipping\Model\Shipping">
        <plugin name="hide_shipping_methods" type="Vendor\Module\Plugin\HideShippingPlugin"/>
    </type>
</config>

then HideShippingPlugin.php

<?php

namespace Vendor\Module\Plugin;

class HideShippingPlugin {

    public function aroundCollectCarrierRates(
        \Magento\Shipping\Model\Shipping $subject,
        \Closure $proceed,
        $carrierCode,
        $request
    ) {

        // Hide free shipping method
        if ($carrierCode == 'freeshipping') {
            return false;;
        } 

        $result = $proceed($carrierCode, $request);
        return $result;
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.