Automattic\WooCommerce\Blocks\Shipping
ShippingController::register_settings()
Register Local Pickup settings for rest api.
Метод класса: ShippingController{}
Хуков нет.
Возвращает
null
. Ничего.
Использование
$ShippingController = new ShippingController(); $ShippingController->register_settings();
Код ShippingController::register_settings() ShippingController::register settings WC 7.7.2
public function register_settings() { register_setting( 'options', 'woocommerce_pickup_location_settings', [ 'type' => 'object', 'description' => 'WooCommerce Local Pickup Method Settings', 'default' => [], 'show_in_rest' => [ 'name' => 'pickup_location_settings', 'schema' => [ 'type' => 'object', 'properties' => array( 'enabled' => [ 'description' => __( 'If enabled, this method will appear on the block based checkout.', 'woocommerce' ), 'type' => 'string', 'enum' => [ 'yes', 'no' ], ], 'title' => [ 'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce' ), 'type' => 'string', ], 'tax_status' => [ 'description' => __( 'If a cost is defined, this controls if taxes are applied to that cost.', 'woocommerce' ), 'type' => 'string', 'enum' => [ 'taxable', 'none' ], ], 'cost' => [ 'description' => __( 'Optional cost to charge for local pickup.', 'woocommerce' ), 'type' => 'string', ], ), ], ], ] ); register_setting( 'options', 'pickup_location_pickup_locations', [ 'type' => 'array', 'description' => 'WooCommerce Local Pickup Locations', 'default' => [], 'show_in_rest' => [ 'name' => 'pickup_locations', 'schema' => [ 'type' => 'array', 'items' => [ 'type' => 'object', 'properties' => array( 'name' => [ 'type' => 'string', ], 'address' => [ 'type' => 'object', 'properties' => array( 'address_1' => [ 'type' => 'string', ], 'city' => [ 'type' => 'string', ], 'state' => [ 'type' => 'string', ], 'postcode' => [ 'type' => 'string', ], 'country' => [ 'type' => 'string', ], ), ], 'details' => [ 'type' => 'string', ], 'enabled' => [ 'type' => 'boolean', ], ), ], ], ], ] ); }