Automattic\WooCommerce\Blocks\Shipping
ShippingController::remove_shipping_settings()
When using the cart and checkout blocks this method is used to adjust core shipping settings via a filter hook.
Method of the class: ShippingController{}
No Hooks.
Return
Array|Mixed
. The filtered settings.
Usage
$ShippingController = new ShippingController(); $ShippingController->remove_shipping_settings( $settings );
- $settings(array) (required)
- The default WC shipping settings.
ShippingController::remove_shipping_settings() ShippingController::remove shipping settings code WC 9.2.3
public function remove_shipping_settings( $settings ) { if ( CartCheckoutUtils::is_checkout_block_default() && $this->local_pickup_enabled ) { foreach ( $settings as $index => $setting ) { if ( 'woocommerce_shipping_cost_requires_address' === $setting['id'] ) { $settings[ $index ]['desc'] = sprintf( /* translators: %s: URL to the documentation. */ __( 'Hide shipping costs until an address is entered (Not available when using the <a href="%s">Local pickup options powered by the Checkout block</a>)', 'woocommerce' ), 'https://woocommerce.com/document/woocommerce-blocks-local-pickup/' ); $settings[ $index ]['disabled'] = true; $settings[ $index ]['value'] = 'no'; break; } } } return $settings; }