Clear cart and add item

Home Forums Legacy Support Support queries How-to & Troubleshooting Clear cart and add item

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #98238
    Daniel Sfair
    Participant
    Hello, In my site I sell two combos' courses: Plano Básico and Plano Total. But the client just can buy one this, once. So I disabled the cart and found a snippet that do what I want. add_filter( 'woocommerce_add_cart_item_data', 'woo_custom_add_to_cart' ); function woo_custom_add_to_cart( $cart_item_data ) { global $woocommerce; $woocommerce->cart->empty_cart(); // Do nothing with the data and return return $cart_item_data; } In this page However, I don't know how to insert this code in my page. Could you help me? Rgds
    #98242
    Daniel Sfair
    Participant
    This reply has been marked as private.
    #98420
    Daniel Sfair
    Participant
    My site is so10minutos.com.br I add the comand above, but it don't works. As I cannot insert the function, I add the cart in checkout page.
    #98437
    Daniel Sfair
    Participant
    Solution B: If the requisition above was not possible, please help me set up the theme so that the following error does not occur: For you replicate the issue, follow these steps: 1. Go to this page and puchase a product (the Plano Básico, for ex), 2. Automatically you will be redirected to the checkout page, please go back to the purchase page without removing the previous product, and Click to purchase the other product (Plano Total, for example) 3. Automatically you will be redirected to the checkout page again. Then click remove the first product, and then try to remove the second product (it is impossible to remove the second product). 4. If you refresh the page, you will receive a series of errors How to solve this?
    #98529
    H.K. Latiyan
    Participant
    Firstly this is handled by woocommerce not by wplms. If you have some code for this then you can add the php code in your functions.php file of your child theme (if using a child theme) or add the code in the wplms-customizer.php file present in your wplms customizer plugin.
Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Clear cart and add item’ is closed to new replies.