Skip to content

Instantly share code, notes, and snippets.

@hedqvist
Created June 30, 2022 09:52
Show Gist options
  • Save hedqvist/d9cfb8ffa277146fe3ba7931ece06ccc to your computer and use it in GitHub Desktop.
Save hedqvist/d9cfb8ffa277146fe3ba7931ece06ccc to your computer and use it in GitHub Desktop.
PostNord - Change default Weight
<?php
/**
* @snippet WooCommerce - Set Default Weight per article to 250g (weight is returned in kilograms)
* @author Redlight Media AB / Christopher Hedqvist
* @compatible WooCommerce 6.0.0
*/
function redlight_postnord_default_weight( $default_weight ) {
$default_weight = 0.250;
return $default_weight;
}
add_filter('redlight_wcpns_shipment_product_default_weight', 'redlight_postnord_default_weight' );
add_filter('redlight_wcpns_shipment_product_customs_invoice_default_weight', 'redlight_postnord_default_weight' );
add_filter('redlight_wcpns_shipment_product_cn22_default_weight', 'redlight_postnord_default_weight' );
add_filter('redlight_wcpns_shipment_product_cn23_default_weight', 'redlight_postnord_default_weight' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment