Skip to content
Snippets Groups Projects

New weight unit for WooCommerce products

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Krzysztof Dyszczyk
    Edited
    functions.php 408 B
    /**
     * This adds the new weight unit to WooCommerce
     */
    function add_woocommerce_weight_unit_pallet( $settings ) {
    
    	foreach ( $settings as &$setting ) {
    		if ( 'woocommerce_weight_unit' == $setting['id'] ) {
    			$setting['options']['pallet'] = __( 'pallet', 'woocommerce' ); // new unit
    		}
    	}
    	return $settings;
    }
    
    add_filter( 'woocommerce_products_general_settings', 'add_woocommerce_weight_unit_pallet' );
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment