woocommerce_save_product_cogs_is_additive_flag

FILTER woocommerce\includes\data-stores\class-wc-product-variation-data-store-cpt.php (ligne 595) github
Filter to customize the "Cost of Goods Sold value is additive" flag that gets saved for a given variable product, or to suppress the saving of the flag (so that custom storage can be used) if null is returned. Note that returning null will suppress any database access (for either saving the flag or deleting it).

Paramètres

Entrée :
$cogs_value_is_additive, $product
Sortie :
@param bool|null $cogs_value_is_additive The flag to be written to the database. If null is returned nothing will be written or deleted.
@param WC_Product $product The product for which the flag is being saved.

Utilisation

// Modifier la valeur avec le filtre 'woocommerce_save_product_cogs_is_additive_flag'
add_filter('woocommerce_save_product_cogs_is_additive_flag', 'ma_fonction_filtre', 10, 1);

function ma_fonction_filtre($cogs_value_is_additive) {
    // Modifier la valeur
    return $cogs_value_is_additive;
}

Actualités

Chargement des actualités...