WC_Settings_Products::get_settings_for_downloadable_section()protectedWC 1.0

Get settings for the downloadable section.

Method of the class: WC_Settings_Products{}

Return

Array.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_settings_for_downloadable_section();

WC_Settings_Products::get_settings_for_downloadable_section() code WC 8.7.0

protected function get_settings_for_downloadable_section() {
	$settings =
		array(
			array(
				'title' => __( 'Downloadable products', 'woocommerce' ),
				'type'  => 'title',
				'id'    => 'digital_download_options',
			),

			array(
				'title'    => __( 'File download method', 'woocommerce' ),
				'desc_tip' => sprintf(
				/* translators: 1: X-Accel-Redirect 2: X-Sendfile 3: mod_xsendfile */
					__( 'Forcing downloads will keep URLs hidden, but some servers may serve large files unreliably. If supported, %1$s / %2$s can be used to serve downloads instead (server requires %3$s).', 'woocommerce' ),
					'<code>X-Accel-Redirect</code>',
					'<code>X-Sendfile</code>',
					'<code>mod_xsendfile</code>'
				),
				'id'       => 'woocommerce_file_download_method',
				'type'     => 'select',
				'class'    => 'wc-enhanced-select',
				'css'      => 'min-width:300px;',
				'default'  => 'force',
				'desc'     => sprintf(
				// translators: Link to WooCommerce Docs.
					__( "If you are using X-Accel-Redirect download method along with NGINX server, make sure that you have applied settings as described in <a href='%s'>Digital/Downloadable Product Handling</a> guide.", 'woocommerce' ),
					'https://woo.com/document/digital-downloadable-product-handling#nginx-setting'
				),
				'options'  => array(
					'force'     => __( 'Force downloads', 'woocommerce' ),
					'xsendfile' => __( 'X-Accel-Redirect/X-Sendfile', 'woocommerce' ),
					'redirect'  => apply_filters( 'woocommerce_redirect_only_method_is_secure', false ) ? __( 'Redirect only', 'woocommerce' ) : __( 'Redirect only (Insecure)', 'woocommerce' ),
				),
				'autoload' => false,
			),

			array(
				'desc'          => __( 'Allow using redirect mode (insecure) as a last resort', 'woocommerce' ),
				'id'            => 'woocommerce_downloads_redirect_fallback_allowed',
				'type'          => 'checkbox',
				'default'       => 'no',
				'desc_tip'      => sprintf(
					/* translators: %1$s is a link to the WooCommerce documentation. */
					__( 'If the "Force Downloads" or "X-Accel-Redirect/X-Sendfile" download method is selected but does not work, the system will use the "Redirect" method as a last resort. <a href="%1$s">See this guide</a> for more details.', 'woocommerce' ),
					'https://woo.com/document/digital-downloadable-product-handling/'
				),
				'checkboxgroup' => 'start',
				'autoload'      => false,
			),

			array(
				'title'         => __( 'Access restriction', 'woocommerce' ),
				'desc'          => __( 'Downloads require login', 'woocommerce' ),
				'id'            => 'woocommerce_downloads_require_login',
				'type'          => 'checkbox',
				'default'       => 'no',
				'desc_tip'      => __( 'This setting does not apply to guest purchases.', 'woocommerce' ),
				'checkboxgroup' => 'start',
				'autoload'      => false,
			),

			array(
				'desc'          => __( 'Grant access to downloadable products after payment', 'woocommerce' ),
				'id'            => 'woocommerce_downloads_grant_access_after_payment',
				'type'          => 'checkbox',
				'default'       => 'yes',
				'desc_tip'      => __( 'Enable this option to grant access to downloads when orders are "processing", rather than "completed".', 'woocommerce' ),
				'checkboxgroup' => 'end',
				'autoload'      => false,
			),

			array(
				'title'    => __( 'Open in browser', 'woocommerce' ),
				'desc'     => __( 'Open downloadable files in the browser, instead of saving them to the device.', 'woocommerce' ),
				'id'       => 'woocommerce_downloads_deliver_inline',
				'type'     => 'checkbox',
				'default'  => false,
				'desc_tip' => __( 'Customers can still save the file to their device, but by default file will be opened instead of being downloaded (does not work with redirects).', 'woocommerce' ),
				'autoload' => false,
			),

			array(
				'title'    => __( 'Filename', 'woocommerce' ),
				'desc'     => __( 'Append a unique string to filename for security', 'woocommerce' ),
				'id'       => 'woocommerce_downloads_add_hash_to_filename',
				'type'     => 'checkbox',
				'default'  => 'yes',
				'desc_tip' => sprintf(
				// translators: Link to WooCommerce Docs.
					__( "Not required if your download directory is protected. <a href='%s'>See this guide</a> for more details. Files already uploaded will not be affected.", 'woocommerce' ),
					'https://woo.com/document/digital-downloadable-product-handling#unique-string'
				),
			),

			array(
				'type' => 'sectionend',
				'id'   => 'digital_download_options',
			),
		);

	return apply_filters( 'woocommerce_downloadable_products_settings', $settings );
}