Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Save custom input field value into cart item

// 3,5. Add fee ;)
 
add_action( 'woocommerce_cart_calculate_fees', 'bbloomer_add_checkout_fee' );
   
function bbloomer_add_checkout_fee() {
   foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
        if (!empty( $cart_item['custom_text_add_on'] ) ) {
           WC()->cart->add_fee( 'Product Add-on fee', 55 );
            break;
        }
    }
}
Source by www.businessbloomer.com #
 
PREVIOUS NEXT
Tagged: #Save #custom #input #field #cart #item
ADD COMMENT
Topic
Name
3+8 =