Change Total Price Of woocommerce total price to a deposit only total

I am running into issues with the cart total only displaying 0 so I was wondering if someone can help me. Essentially what I am trying to do is only accept a deposit total of a certain amount after all cart items have been added to the carts subtotal. So for example if the customer adds $100 worth of items, they would only pay $10 initially or (10%) of the subtotal as the total value. I took the code from here: Change total and tax_total Woocommerce and modified it to look like this:

add_action('woocommerce_cart_total', 'calculate_totals', 10, 1);

function calculate_totals($wc_price){
$new_total = ($wc_price*0.10);

return wc_price($new_total);
} 

but the total page shows 0.00 when that code is entered. When removed it returns the standard total. I am new to woocommerce programming but not to programming in general so some of the api is causing some confusion for me and I apologize in advance for what maybe a simple question. I also could not find on the woocommerce site where the full api is listed, only generic articles related to how to create a plugin. which is why I am on stackoverflow.

Any help or a point in the right direction would be great.

Read more here: Change Total Price Of woocommerce total price to a deposit only total

Leave a Reply

Your email address will not be published. Required fields are marked *