woocommerce product price change based on formula

Here’s the formula:

(raw material cost) + (fee_1 for processing) + (fee_2 for other processes) = final price.

Read More

+What I need is:

  1. Set the (raw material cost) to a number globally, change it accordingly, basically weekly;
  2. (fee_1) is set in the product admin page as an attribute;
  3. same with (fee_2).

+My problem is:

  1. dont have a clue about how to set a global material cost to the database with a admin frontend page.
  2. the (fee_1) and (fee_2) seem like easier, I’ve read some pages, just need to test it.

Any one can provide me with some links or guides about how to get that?
High appriciated!
Michael

Related posts

1 comment

  1. You can use this code to functions.php to add raw material cost to the whole cart and you can update it every week.

    function woo_add_cart_fee() {
    
      global $woocommerce;
    
      $woocommerce->cart->add_fee( __('Custom', 'woocommerce'), 5 );
    
    }
    add_action( 'woocommerce_cart_calculate_fees', 'woo_add_cart_fee' );
    

    But this won’t be for every product and will be added to the whole cart no matter how many products there are.

    To add raw material cost to each product based on the quantity, a much better way would be to use this plugin “Woocommerce product fee

Comments are closed.