Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am writing a "bike configurator" plugin for a bike shop that uses Woocommerce to host their product on Wordpress.

The idea is to enable the customer to select the parts and colours for their complete bike, I have linked the configurator to the products in the Woocommerce backend - so far so good. The problem is that the 'complete' bike package cost should be different to the sum of the individual parts.

My plan is to add a custom-field in Woocommerce "configurator_price", when I add the items to the cart add a 'complete_bike'=true flag in the cart item data. Then I need to use this price when checking out.

What hooks should do this? i.e. when and where is the cart item price saved?

share|improve this question

1 Answer

Have a close look at the "classes/class-wc-cart.php" code. In there you will find functions related to the cart, and you'll notice "do_action" and "apply_filter" hooks in functions that you can use to interact with the cart when a product is added, or when the cart total is calculated, etc.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.