/** * External dependencies */ import { __ } from '@wordpress/i18n'; import { ADMIN_URL } from '@woocommerce/settings'; import { CHECKOUT_PAGE_ID } from '@woocommerce/block-settings'; import { CheckboxControl, SelectControl, TextControl, ExternalLink, } from '@wordpress/components'; import { useState } from '@wordpress/element'; /** * Internal dependencies */ import { SettingsCard, SettingsSection } from '../shared-components'; import { useSettingsContext } from './settings-context'; const GeneralSettingsDescription = () => ( <>

{ __( 'General', 'woo-gutenberg-products-block' ) }

{ __( 'Enable or disable Local Pickup on your store, and define costs. Local Pickup is only available from the Block Checkout.', 'woo-gutenberg-products-block' ) }

{ __( 'View checkout page', 'woo-gutenberg-products-block' ) } ); const GeneralSettings = () => { const { settings, setSettingField } = useSettingsContext(); const [ showCosts, setShowCosts ] = useState( !! settings.cost ); return ( { setShowCosts( ! showCosts ); setSettingField( 'cost' )( '' ); } } label={ __( 'Add a price for customers who choose local pickup', 'woo-gutenberg-products-block' ) } help={ __( 'By default, the local pickup shipping method is free.', 'woo-gutenberg-products-block' ) } /> { showCosts ? ( <> ) : null } ); }; export default GeneralSettings;