Skip to main content
added 421 characters in body
Source Link
Amit Bera
  • 77.7k
  • 20
  • 124
  • 239

Let's manage your requirement in a logical way.

At collectRates() you can check the current area of checkout and disbaled your shipping methjod.

$this->appState->getAreaCode() == 'webapi_rest'.

But this solution has a major disadvantage in that the shipping method is also showing on Magento Own checkout page as Magento checkout page shipping method are showing using rest API.

To resolve the issue let's create a field to quote table at the database called is_webapi_checkout and make this field value default value 0 and make this field value to 1 when Add to Cart happen using rest API.

Let's manage your requirement in a logical way.

At collectRates() you can check the current area of checkout and disbaled your shipping methjod.

$this->appState->getAreaCode() == 'webapi_rest'

Let's manage your requirement in a logical way.

At collectRates() you can check the current area of checkout and disbaled your shipping methjod.

$this->appState->getAreaCode() == 'webapi_rest'.

But this solution has a major disadvantage in that the shipping method is also showing on Magento Own checkout page as Magento checkout page shipping method are showing using rest API.

To resolve the issue let's create a field to quote table at the database called is_webapi_checkout and make this field value default value 0 and make this field value to 1 when Add to Cart happen using rest API.

Source Link
Amit Bera
  • 77.7k
  • 20
  • 124
  • 239

Let's manage your requirement in a logical way.

At collectRates() you can check the current area of checkout and disbaled your shipping methjod.

$this->appState->getAreaCode() == 'webapi_rest'