Skip to content

Instantly share code, notes, and snippets.

@hedqvist
Created August 25, 2022 12:43
Show Gist options
  • Save hedqvist/d609520dc5c2b2ae438c867af4f7e452 to your computer and use it in GitHub Desktop.
Save hedqvist/d609520dc5c2b2ae438c867af4f7e452 to your computer and use it in GitHub Desktop.
Fortnox - Stock Amount from QuantityInStock instead of DisposableQuantity
<?php
/**
* @snippet WooCommerce - Fortnox plugin by Redlight Media - Hämta lagersaldo från en 'i lager' istället för Disponibelt antal
* @author Redlight Media AB / Christopher Hedqvist
* @compatible WooCommerce 6.8.0
*/
function redlight_fortnox_stock_quantity_in_stock ( $DisposableQuantity, $WC_Product, $fortnox_article ) {
return $fortnox_article->Article->QuantityInStock;
}
add_filter('obj_fortnox_product_stock_amount', 'redlight_fortnox_stock_quantity_in_stock', 10,3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment