Untitled diff

Created Diff never expires
3 removals
Lines
Total
Removed
Words
Total
Removed
To continue using this feature, upgrade to
Diffchecker logo
Diffchecker Pro
9 lines
3 additions
Lines
Total
Added
Words
Total
Added
To continue using this feature, upgrade to
Diffchecker logo
Diffchecker Pro
9 lines
add_action( 'woocommerce_cart_calculate_fees', 'wcpf_testing_fees', 15 );
add_action( 'woocommerce_cart_calculate_fees', 'wcpf_testing_fees', 15 );
function wcpf_testing_fees() {
function wcpf_testing_fees( $cart ) {
WC()->cart->add_fee( 'Custom Fee', '5' );
$cart->add_fee( 'Custom Fee', '5' );


foreach( WC()->cart->get_cart() as $cart_item => $values ) {
foreach( $cart->get_cart() as $cart_item => $values ) {
error_log('looping through for product ID #' . $values['product_id']);
error_log('looping through for product ID #' . $values['product_id']);
}
}
}
}