2

Is there are any way to edit wordpress/woocommerce product variations on cart page? for example if user select a shirt with variation Color Blue and variation size XL and add product to cart, On cart page if user want to change these how this will be done?

I have't try any code yet because i wonder its technically possible or not. any help will be appreciated.

closed as off-topic by fuxia Nov 28 '16 at 12:59

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • Of course it's technically possible, code is code. But I think it'll take a bit of coding in PHP and a bit of UI work, too much for a single question on SO/SE I think. You'll need to: build the UI; query the product's variations to produce to the UI; query the current cart to get the current variations of the product for that user; on the 'submit'/'update' product button, the URL needs to go to the cart and have URL parameters for product_id and the variations info; Then, add a hook to redirect back to checkout page (or just do it via AJAX). Search 'woocommerce update cart url' – Dan. Nov 28 '16 at 12:36
  • @Dan thanks for your idea, can you tell me the exact hook that i have to use? i have done little work with woocommerce_update_cart hook but i won't update the cart items when use variation form in it. Can you suggest any other hook? – fmeaddons Nov 28 '16 at 12:41
  • You don't need to use a hook to actually update the cart, you just need to send the user to the correct URL. I meant a hook to redirect the user after the cart has been updated. You can use the woocommerce_cart_updated hook to detect when the cart has been updated, and then redirect user back to checkout page. – Dan. Nov 28 '16 at 12:48
  • .. And, within your hooked function, put an if statement to check where/why the user is coming from (otherwise all users will be getting redirected to checkout when they click on the cart link). You can add another URL parameter, when updating from checkout, and check for it in your function. – Dan. Nov 28 '16 at 12:51

Browse other questions tagged or ask your own question.